Filtering
When you make a GET
request to any WhereAPI endpoint, you get a default load of fields. It's a great practice to request only what you want. This section will walk you through tailoring your response payload.
Here's what a default request for states in Nigeria returns
#
Request only what you wantLet's be honest, we don't need all these fields. You can customize the fields in your response with the fields
query param. Just provide a comma-separated list of items to the fields
query param
Let's assume we want only the name
and description
fields. Here's how we'll go about it
Take a closer look
Our response will be similar to
Implementing this in your app will greatly reduce your response payload and make your app respond faster.
info
If you include a field that doesn't exist ?fields=jasdasd,askdasd
, the API will ignore it and send only valid fields.