Best Practices
Use HTTPS for every request.
Protect secrets. Keep
client_secret, passwords, access tokens and refresh tokens in a secret manager or protected environment variables.Use the Authorization header for tokens, never URLs.
Redact before sharing. Remove credentials, tokens, personal data and pass download URLs from logs and examples.
Cache your token until it expires, then authenticate again, instead of requesting a token for every page.
Follow pagination headers instead of assuming the first response has every record.
Request minimal scopes for each integration.
Be tolerant of change. Handle null fields, and fields added by the API, without failing the whole response.
Example Workflow: Sync Members and Track Their Cards
This is an example of how the operations can fit together. Adapt it to your system.
Authenticate. Request a token with the scopes
write_external_users read_external_users read_pass_books.Create members. For each new member in your system, send
POST /api/v5/external_userswith your own ID asexternal_id.Check card status. Call
GET /api/v5/pass_booksfiltered byf[external_user_external_id_eq]to see a member's pass book and itsstatus(sent,not_installed,installedoruninstalled).Look for changes. Periodically call
GET /api/v5/pass_bookswithf[updated_at_gteq]set to your last check time to find pass books that changed.Follow pagination. Keep requesting pages until
X-Next-Pageis empty.Refresh the token when it expires.
Using external_id
Use your system's member identifier as external_id. It is the link between your records and Cuseum's, and you can use it to filter pass books.
