API
Filter
Filtering is a powerful feature that allows you to narrow down the results returned by your API by applying specific conditions to the data. In your API, you've implemented filtering using HTTP parameters to customize the outcome according to the criteria set by the user.
For instance, you can use the "name[eq]=Zoom" parameter to filter the data and retrieve only the entries with the exact name "Zoom". This method ensures that the API returns results that match the provided name precisely.
Information about specific parameters that can be used to perform a search is provided on the respective resource-specific page. This ensures that users have a clear reference point to understand and effectively use the available parameters to refine their search results.
Filter parameters
Our API offers various other filtering methods that enhance the flexibility of your search. Here's a breakdown of some of these methods:
Custom filters
-
- Name
- [eq]
- Type
- Equal
- Description
-
This method allows you to exactly find entries that match the parameter. "status[eq]=active".
-
- Name
- [ne]
- Type
- Not Equal
- Description
-
This method allows you to exclude entries that match the parameter. "status[ne]=inactive" would exclude entries with the "inactive" status.
-
- Name
- [lt]
- Type
- Less Than
- Description
-
Using this method, you can retrieve records that have values less than the specified parameter. For example, "age[lt]=30" would return data entries with an age value less than 30.
-
- Name
- [lte]
- Type
- Less Than Equal
- Description
-
This method lets you retrieve entries with values less than or equal to the parameter. "rating[lte]=4.5" would return data with ratings up to and including 4.5.
-
- Name
- [gt]
- Type
- Greater Than
- Description
-
This method enables you to fetch records with values greater than the provided parameter. For instance, "price[gt]=100" would yield data entries with prices higher than 100.
-
- Name
- [gte]
- Type
- Greater Than Equal
- Description
-
By using this method, you can obtain records with values greater than or equal to the parameter. "quantity[gte]=10" would fetch entries with quantities of 10 or more.
-
- Name
- [like]
- Type
- Like
- Description
-
This method lets you perform a partial match search. For instance, "description[like]=cloud" would return data entries with descriptions containing the word "cloud".
Example request for Software equals Zoom
.../api/v1/software?name[eq]=Zoom
.../api/v1/publisher?name[like]=Microsoft
Example request for a publisher name like Microsoft
.../api/v1/publisher?name[like]=Microsoft