Pagination
Several Fieldwire GET
endpoints return a list of items. In order to control how many items are returned in the response we use Fieldwire-Per-Page
request header. The X-Last-Synced-At
response header contains information to include in the next request to fetch the subsequent page
Request Header | Description |
---|---|
Fieldwire-Per-Page | Number of items returned (default: 50, max: 1000) |
Response Header | Description |
---|---|
X-Count | Number of entities in response |
X-Has-More | Boolean indicating if additional entities exist |
X-Last-Synced-At | UTC indicating how up to date the client is after processing the response |
The following is an example of how to retrieve 150 projects using a page size of 100 projects per request.
GET /projects HTTP/1.1
Authorization: Bearer <access_token>
Fieldwire-Per-Page: 100
Fieldwire-Version: 2023-12-25
HTTP/1.1 200 OK
Content-Type: application/json
X-Count: 100
X-Has-More: true
X-Last-Synced-At: 2019-01-01T00:00:00.000Z
[
...99 projects...,
{
"id": "b5c08097-74f1-4a8f-a9a8-52e16295f6a4",
"name": "Project 100",
"updated_at": "2019-01-01T00:00:00.000Z",
}
]
Utilizing the X-Last-Synced-At
from the previous call we can make another call to get the next page of 100 items.
GET /projects?last_synced_at=2019-01-01T00:00:00.000Z HTTP/1.1
Authorization: Bearer <access_token>
Fieldwire-Per-Page: 100
Fieldwire-Version: 2023-12-25
HTTP/1.1 200 OK
Content-Type: application/json
X-Count: 50
X-Has-More: false
X-Last-Synced-At: 2019-02-01T00:00:00.000Z
[
...49 projects...,
{
"id": "37b9103e-e3eb-438f-8c38-5f2736a952dd",
"name": "Project 150",
"updated_at": "2019-02-01T00:00:00.000Z",
}
]
Updated 10 months ago