Hands-On RESTful API Design Patterns and Best Practices
上QQ阅读APP看书,第一时间看更新

URI query

This section discusses rules relating to the design of the query (scheme "://" authority "/" path [ "?" query ] [ "#" fragment ]) portion of the REST API URIs.

The query component of the URI also represents the unique identification of the resource, and following are the rules about URI queries:

  • Use the query to filter collections or stores:
    • An example of the limit in the query: https://api.lufthansa.com/v1/operations/flightstatus/arrivals/ZRH/2018-05-21T06:30?limit=40
  • Use the query to paginate collection or store results:
    • An example with the offset in the query: https://api.lufthansa.com/v1/operations/flightstatus/arrivals/ZRH/2018-05-21T06:30?limit=40&offset=10