API Model for Search Service
Learn the request and response structure of a search query.
In this lesson, we model the search API to meet the functional requirements we identified in the first lesson. We also focus on essential data entities to be exchanged in the request and response while targeting various endpoints.
Let's start the discussion by defining the base URL for our search API.
Base URL and API endpoints
The base URL can be defined as the common prefix for all the endpoints of API. We defined the following base URL for the search API:
The following illustration represents the URLs and their HTTP methods used by the search service.
The details of query string parameters that we mentioned in the URLs above are given below:
Search: The search keywords are passed as a
query
parameter along with the base URL.Sort: The
order
defines the sequence of the records (such as descending or ascending). Additionally, thesort
parameter sorts the results based on the field provided in the query parameter—for example, ...