projqoDevelopers

Guide

Paging and lists

Cursors, counts, filters, sorting, choosing fields, and keeping a copy in step.

Paging with a cursor

Every list answers one page at a time:

JSON
{
  "items": [ … ],
  "next_cursor": "…"
}
  • limit sets the page size: from 1 to 200, 50 when you leave it out.
  • When next_cursor is a string, there is another page: send it back as cursor with the same parameters.
  • When next_cursor is null, that was the last page.

A cursor stays correct while items are added or changed, so paging through a project of thousands of tasks never skips or repeats one, the way page numbers can. The one exception is a list sorted by the time of change (sort=-updated or ORDER BY updated): a task changed while you page moves to the other end of the order, so it can be passed over or come twice. To keep a copy in step, page in the default order (or by key) and then ask for updated_since.

cURL
cursor=""
while :; do
  page=$(curl -sG "$PROJQO_API/orgs/$PROJQO_ORG/projects/$PROJECT/tasks" \
    -H "Authorization: Bearer $PROJQO_TOKEN" \
    --data-urlencode "limit=200" \
    ${cursor:+--data-urlencode "cursor=$cursor"})
  echo "$page" | jq -r '.items[].key'
  cursor=$(echo "$page" | jq -r '.next_cursor // empty')
  [ -z "$cursor" ] && break
done

Counting

  • count=true adds total, the number of items in the whole list, to the answer.
  • /count calls (such as GET /tasks/count?q=…) answer the number alone, without the items.

Filtering

  • Tasks are filtered with the query language of Advanced search, in q: q=project = WEB AND status = "In review". See the query language.
  • Other lists take plain parameters, such as ?project=, ?status= or ?updated_since=. Each list's parameters are in the reference.
  • A saved filter: filter={id} runs a saved filter the person may open.

Sorting

sort takes one or more field keys, separated by commas; - in front sorts that key from the highest down:

Text
sort=-updated,key

For tasks you can also end q with ORDER BY: q=project = WEB ORDER BY rank.

Choosing fields

  • fields=summary,status,assignee returns only those fields of each item (with its id), which makes big lists smaller and faster.
  • expand=comments,watchers,changes puts related lists inside each item: the first 20 of each, with a cursor for the rest.

Keeping a copy in step

To keep your own copy of projqo's data up to date without reading everything again:

  1. Read everything once, page by page.
  2. Afterwards, ask only for what changed: every list takes updated_since (a date-time).
  3. Ask for what was deleted: GET /tasks/deleted?since=… (and the same for Docs pages).

Or subscribe to webhooks and hear about each change as it happens.