liveBook · Manning

Structured filter representation

As explained in API Design Patterns

A structured filter representation encodes filtering criteria as structured data conforming to a defined schema.

A structured filter representation encodes filtering criteria as data conforming to a defined schema. The client parses the desired query into that structure, while the API server evaluates it with little or no content parsing. section 22.3.1

Structured filters and SQL-style string queries can express equivalent requirements and can be transformed through serialization and parsing. The practical choice therefore centers on client usability and long-term flexibility rather than filtering capability alone. section 22.3.1

Filtering ChatRoom resources

A MongoDB-style filter such as { title: "New Chat!", userLimit: { $gt: 5 } } represents equality and comparison criteria directly as structured fields. Logical alternatives can use operators such as $in and $or. section 22.3.1

Listing 22.4 Example MongoDB structured query for filtering ChatRoom resources
db.chatRooms.find( { title: "New Chat!" } );

View the compact MongoDB query for filtering ChatRoom resources. section 22.3.1

How API Design Patterns covers it

How deep it goes
Compares structured and string filters, explains their transformation, and illustrates common operators without detailing schema design.
Examples
Uses ChatRoom filters for equality, comparison, membership, conjunction, disjunction, and grouped conditions.
What you can do after
Evaluate structured and string filter designs against client usability and future flexibility.
How it connects
Connects filtering with SQL queries, MongoDB, serialization, parsing, and API server evaluation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of API Design Patterns. The section links point to the parts of the book it draws on.