Skip to main content

Integration Best Practices and a Typical Workflow

Recommended habits for a secure, reliable integration, plus an example end-to-end flow.

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.

  1. Authenticate. Request a token with the scopes write_external_users read_external_users read_pass_books.

  2. Create members. For each new member in your system, send POST /api/v5/external_users with your own ID as external_id.

  3. Check card status. Call GET /api/v5/pass_books filtered by f[external_user_external_id_eq] to see a member's pass book and its status (sent, not_installed, installed or uninstalled).

  4. Look for changes. Periodically call GET /api/v5/pass_books with f[updated_at_gteq] set to your last check time to find pass books that changed.

  5. Follow pagination. Keep requesting pages until X-Next-Page is empty.

  6. 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.

Did this answer your question?