warden

Integrate

Read records back

Read one record by your own id, or walk everything your key holds, a page at a time.

One record

GET /api/v1/integration/entitlements/<external_id>
Authorization: Bearer wik_...

Returns the same item a write returns, or 404 with not_found. Use it when you have lost a public_id. It reads only what this key's provider wrote.

Everything your key holds

GET /api/v1/integration/entitlements?limit=500&cursor=<next>
Authorization: Bearer wik_...

Every record your key's provider holds, in external_id order, 500 to a page unless limit asks for fewer. limit is a whole number from 1 to 500. Pass next back as cursor for the following page, and stop when next is null.

A cursor is opaque. Store it only to finish the walk you started. A cursor this API never returned is refused with invalid_request.

async function everything(key: string) {
  const held = []
  let cursor: string | null = null
  do {
    const url = new URL('https://3dwarden.com/api/v1/integration/entitlements')
    if (cursor) url.searchParams.set('cursor', cursor)
    const res = await fetch(url, { headers: { Authorization: `Bearer ${key}` } })
    if (!res.ok) throw new Error(`${res.status} ${(await res.json()).code}`)
    const page = await res.json()
    held.push(...page.records)
    cursor = page.next
  } while (cursor)
  return held
}

Diff against your own records

A member you hold that the list lacks was never written. A record the list has that you no longer hold is still there, because Warden never removes a record by omission. Send it as inactive.

Each page is one request against the key's allowance.

What you cannot read yet

The identities your members added through an enrollment invitation, and only what changed since a given time. See what is not available yet.