Query Parameters

Weza.io supports filtering, pagination and ordering of resources for list and search API operations using query parameters. This means that these types of operations have special request parameters and response formats unlike create, get, patch or delete operations. Always confirm from our REST Reference whether any of the query parameters described below are supported for the API you would like to use.

Filtering

You can include a filter query expression for an API operation if the filter option is supported as a query parameter. A filter is a list of space delimited entity query condition clauses, in the form <FIELD>:<VALUE> <FIELD>:<VALUE> <FIELD>:<VALUE>. Each clause represents a field-value pair separated by a colon, with the field here being a resource entity attribute. For each API resource, only a subset of entity attributes are supported as filter fields. These fields will be outlined in the REST reference documentation for each resource . An example of an API list operation with a filter is as shown below. (Note that all the example URLs here are not encoded, but you will need to encode all requests to the API.)

curl --request GET 'https://lending.wezaapis.com/v1/projects/test-project/apps/test-app/events?filter=accountId:borrower:10023 eventType:personal_data.captured' \
--header 'Authorization: Bearer usevalidauthtoken'

Note that in the example, the accountId filter value borrower:10023 also has a colon within it but this is okay since the API only picks the first colon as a field delimiter and ignores any subsequent ones.

Pagination

Pagination is enabled only if the pageSize and pageToken query parameters are supported for an API operation. All APIs have a maximum page size of 1000 items. You can set a lower page size using the pageSize query parameter as shown below.

curl --request GET 'https://lending.wezaapis.com/v1/projects/test-project/apps/test-app/events?pageSize=100' \
--header 'Authorization: Bearer usevalidauthtoken'

If the size of the requested data is above the pageSize, then you will receive a nextPageToken in the response. All paginated results are by default ordered in ascending order using the createdAt date field found in each resource entity. An example of the response structure is shown below.

JSON response
JSON response
{
"events": [
{
....
}
],
"nextPageToken": string,
}

To fetch the next page of data send the same API request but now with the pageToken query parameter which will be the nextPageToken you received previously. You will now get the results of the second page. Repeat this until the nextPageToken is null at which point the data has all been returned. Remember to encode the request URL each time before you send a paginated request as the pageToken value contains special characters that will be altered if left un-encoded.

If at any point you send the wrong pageToken or a different pageSize you will receive a 400 error status code with the error_description value as Invalid page token.

Ordering

By default list and search operations return results in ascending order using the resources' createdAt date field. You can reverse using the order query parameter if it is supported. An example of an API request that returns results in descending order is as shown below.

curl --request GET 'https://lending.wezaapis.com/v1/projects/test-project/apps/test-app/events?order=desc' \
--header 'Authorization: Bearer usevalidauthtoken'

Combining Query Parameters

You can combine any 2 or all query parameters. The example request below combines filter, pagination and order parameters.

curl --request GET 'https://lending.wezaapis.com/v1/projects/test-project/apps/test-app/events?filter=accountId:borrower:10023 eventType:personal_data.captured&pageSize=100&order=desc' \
--header 'Authorization: Bearer usevalidauthtoken'