Custom Queries

This guide will provide you with how to use a custom query for any APIs.

Usually, custom queries can be made by using query params in any APIs calls.

Get records that are equals to the exact value for the particular field.

If we say we need to get all the products of chocolate below is the example API request URL

https://demo.fireapis.com/product/?name=chocolate

Now this request gives all the records which have name equals to chocolate only

{field_name}__iexact - Get records that are equals to the exact value which is case-insensitive for the particular field.

If we say we need to get all the products of the phone which are to be case-insensitive below is the example API request URL

https://demo.fireapis.com/product/?name__iexact=phone

Now, this request gives all the records which have name equals to phone, Phone, PHone, PhOne.

{field_name}__contains - Get records contains the given value for the particular field.

If we say we need to get all the products related to the phone which is to be case-insensitive below is the example API request URL

https://demo.fireapis.com/product/?name__contains=phone

Now, this request gives all the records which have a name as The phone, A phone, This phone.

{field_name}__icontains - Get records to contain the given value which is case-insensitive for the particular field.

If we say we need to get all the products related to the phone which is to be case-insensitive below is the example API request URL

https://demo.fireapis.com/product/?name__contains=phone

Now, this request gives all the records which have a name as The phOne, A Phone, This pHone.

{field_name}__gt - Get records greater than the given value for the particular field.

If we say we need to get all the products greater than 1, below is the example API request URL

https://demo.fireapis.com/product/?id__gt=phone

Now this request gives all the records whose id field is greater than 1

{field_name}__gte - Get records greater and equals to the given value for the particular field.

If we say we need to get all the products equal to 2 and greater than, below is the example API request URL

https://demo.fireapis.com/product/?id__gte=phone

Now, this request gives all the records whose id field is greater and equals 2.

{field_name}__lt - Get records lesser than the given value for the particular field.

If we say we need to get all the products lesser than 10.below is the example URL

https://demo.fireapis.com/product/?id__lt=10

Now this request gives all the records whose id field is lesser than 10

{field_name}__lte - Get records lesser than and equals to a given value for the particular field.

If we say we need to get all the products lesser than and equals to 10.below is the example URL

https://demo.fireapis.com/product/?id__lte=10

Now this request gives all the records whose id field is lesser than and equals 10

Previous - Authorization
Next - Field