Filtering, pagination, ordering, and excluding fields

The API allows results to be paginated, filtered, and ordered, and for fields to be excluded from the result.

Filtering

Result sets can be filtered against certain fields. To filter on a field, simply add the field as a request argument. For example, to fetch bonds using the IDMPQ packet distribution algorithm, use this URI:

/api/v4/bonds/?packet_distribution=idmpq

Multiple filter fields can be separated by ampersands (&).

One special filtering argument is search. Some resources support the search parameter to filter on multiple fields at once. For example, to search for bonds that have the term “foo” in either the note field, bonder name, or bonder version, fetch this URI:

/api/v4/bonds/?search=foo

Not all fields on a resource are available for filtering or searching. If you would like to filter on a field that isn’t currently available for filtering or search, please contact technical support.

Ordering

To retrieve a result set ordered by a field or set of fields, add an ordering parameter to the request. For example, to list bonds by current download rate, with highest throughput bonds last, fetch this URI:

/api/v4/bonds/?ordering=download_rate,

To sort by multiple fields, separate the field names with a comma:

?ordering=field1,field2

By default, smallest values are listed first. To perform a descending sort instead of an ascending sort, add a dash to the field name:

?ordering=-field1,field2

Excluding fields

Fields can be excluded from a response in order to make it return faster, because the server needs to collect less information when creating the response, or to reduce the size of the response to reduce network usage.

To exclude one or more fields from the response, add one or more exclude_fields parameters to the URI query string. For example, to exclude the progress_results field from a speed test response, use the following URI:

/api/v4/bonds/1/speedtests/?exclude_fields=progress_results

To exclude multiple fields, add multiple exclude_fields parameters:

?exclude_fields=progress_results&exclude_fields=actual_length