get started

Pagination

List endpoints return one page of items at a time. Ask for the next page until the response says it is the last one.

Parameters

ParameterDefaultWhat it does
page0Page to return, starting at 0.
size50 on most endpointsItems per page. Each endpoint's reference lists its default.
sortField to sort by, optionally followed by a direction: name,desc.

Response

{
  "content": [],
  "totalElements": 132,
  "totalPages": 3,
  "number": 0,
  "size": 50,
  "first": true,
  "last": false
}
FieldWhat it holds
contentThe items of this page.
totalElementsItems across every page.
totalPagesNumber of pages at this size.
numberThis page's index, from 0.
first, lastWhether this is the first or the last page.

Read every page

This loop prints every project, one per line, with List Projects:

page=0
while :; do
  body=$(curl -s "https://app.wxrks.com/api/v3/project?page=$page&size=50" -H "X-AUTH-TOKEN: $WXRKS_TOKEN")
  echo "$body" | jq -c '.content[]'
  [ "$(echo "$body" | jq .last)" = true ] && break
  page=$((page + 1))
done