API – lists, filtering and pagination
Some API methods return a list of items (e.g. referrals, orders, movements on the commission account).
These methods share the same behaviour – the same input parameters for filtering and pagination and also a uniform output structure.
Output data
The response of methods that return a list always contains these items:
- results – an array of objects with the individual items of the list
- page – the current page number
- count – the number of items returned in the response
- filteredCount – the number of items matching the current filters
- totalCount – the total number of items without filters
Example response
The individual items in results are not listed here:
{ "results": [ ... ], "page": 1, "count": 10, "filteredCount": 18, "totalCount": 624, "requestId": "..." }
In total there are 624 items (e.g. orders),
of which 18 match the current filters and the first
10 items were returned (page 1, page size 10).
Filtering
You can add one or more filters to the request. Filters are passed as GET parameters and are used to select the items that the API returns.
- ID – returns only the item with the specific record ID
- lastID – returns only items whose ID is higher than the entered value (suitable for loading new items)
lastID is ideal if you regularly fetch new items
from the last known ID and do not want to deal with paging backwards.
Example – orders with an ID higher than 1234
https://api.wedos.as/partner/orders?lastID=1234
Pagination
Lists can be paginated, that is, returned only in certain batches. The API can return at most 1000 items per call.
- page – default 1
- count – default 100
- count – max 1000
When you want just a small preview (e.g. 10 items), you set count=10.
When you download larger batches, keep it reasonable (say 100-300) so that you do not put unnecessary load on the endpoint.
Example – 10 items on the second page
Returns items 11 to 20:
https://api.wedos.as/partner/orders?page=2&count=10
If you are not sure
If you are not sure about filtering or pagination in a specific method, you can use the public discussion forum, or write to us directly by e-mail:
affiliate@wedos.com.