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
| Parameter | Default | What it does |
|---|---|---|
page | 0 | Page to return, starting at 0. |
size | 50 on most endpoints | Items per page. Each endpoint's reference lists its default. |
sort | Field to sort by, optionally followed by a direction: name,desc. |
Response
{
"content": [],
"totalElements": 132,
"totalPages": 3,
"number": 0,
"size": 50,
"first": true,
"last": false
}
| Field | What it holds |
|---|---|
content | The items of this page. |
totalElements | Items across every page. |
totalPages | Number of pages at this size. |
number | This page's index, from 0. |
first, last | Whether 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