projqoDevelopers

Guide

Idempotency and bulk calls

Make a create safe to send again, and change up to 100 tasks in one call.

Idempotency keys

A network can fail after projqo made your task but before you got the answer. Sent again, a create would make a second task. An idempotency key makes it safe to send again.

Send an Idempotency-Key header with any POST that creates something. Use a new random value for each new thing you create, such as a uuid, and the same value when you send that same request again.

cURL
curl -X POST "$PROJQO_API/orgs/$PROJQO_ORG/projects/$PROJECT/tasks" \
  -H "Authorization: Bearer $PROJQO_TOKEN" \
  -H "Idempotency-Key: 0b7d3f2e-6c1a-4f0e-9d8b-2a5c7e1f4b90" \
  -H "Content-Type: application/json" \
  -d '{"type": "Task", "summary": "Renew the support contract"}'

type takes a task type's name or id (the project's default type without it); the other fields go by their keys.

What projqo does with it:

  • The same key from the same token, within 24 hours, with the same body: you get the first answer again, and nothing is created a second time.
  • The same key with a different body: 422 with the code idempotency_key_reused. Use a new key for a new request.
  • Keys belong to a token: another token's request with the same key is a different request.

Bulk calls

  • Bulk create: up to 100 tasks in one call.
  • Bulk update: up to 100 tasks in one call, in any projects the person may edit.
  • Bulk work logs: many work logs in one call.

Each item runs on its own, as if it were its own call: in its own transaction, firing its own events and webhooks. One bad item doesn't stop the others.

The call answers 207, with one result per item, each with its index in your request, so you can tell which ones to fix and send again.

Each result has the item's index (from 0), the status that item alone would have had, and either the item (as its own call answers it) or the error (in the usual error shape, without the outer error key). The answer is 207 whenever the call itself was accepted, also when every item worked:

JSON
{
  "results": [
    {
      "index": 0,
      "status": 201,
      "item": { "id": "…", "key": "WEB-41", "summary": "Renew the support contract" }
    },
    {
      "index": 1,
      "status": 400,
      "error": {
        "code": "invalid",
        "message": "Give the task a summary.",
        "status": 400,
        "request_id": "…",
        "details": [
          { "field": "summary", "code": "required", "message": "Give the task a summary." }
        ]
      }
    }
  ]
}

A bulk call counts against the rate limit as one call per 10 items.