Docs / API reference
Pagination
Read a long list page by page, up to 2000 records at a time, by following the next link.
Parameters
page is the page to return, from 1. per_page is the number of records per page, from 1 to 2000, with 2000 when it is left out. A bad value is refused with 400 and Harvest's message: Invalid per_page parameter: must be from 1 to 2000, Invalid per_page parameter: must be an integer, Invalid page parameter: must be greater than 0, or Invalid page parameter: must be an integer. A page past the end returns no records, with previous_page set to the last page.
Response
Each list response holds the records under the collection name, such as time_entries, and these fields:
| Field | Type | Meaning |
|---|---|---|
per_page | integer | Records per page. |
total_pages | integer | Pages in the list. 1 for an empty list. |
total_entries | integer | Records in the list. |
next_page | integer or null | The next page number, or null on the last page. |
previous_page | integer or null | The previous page number, or null on the first page. |
page | integer | This page. |
links | object | first, next, previous and last: addresses of those pages, with the request's filters, page, per_page and ref (first, next, previous or last), keys in alphabetical order as Harvest writes them. next and previous are null where there is no such page. |
To read a whole list, request links.next until it is null. As in Harvest, the first page links to the next by a cursor (ref=next_cursor), and a page read by a cursor has page, next_page and previous_page null and links on by cursors (next_cursor and previous_cursor). Other pages link by page number, and first and last are page links. Send a cursor back as it came: it is opaque. page and cursor are both accepted, and a cursor wins over page. A cursor this API did not write is refused with 422: Invalid cursor parameter: must be a valid base64 encoded JSON string.
Lists are in Harvest's order: newest first for people, clients, projects, tasks, roles and assignments; time entries by date, newest date first, then newest entry first; billable rates oldest first; time reports by name; the uninvoiced and budget reports by client, then project.