|
|
il y a 1 semaine | |
|---|---|---|
| .. | ||
| README.md | il y a 1 semaine | |
| irdb-local.postman_environment.json | il y a 1 semaine | |
| irdb.postman_collection.json | il y a 1 semaine | |
Import these two files into Postman (or Bruno/Insomnia, which read the v2.1.0 format) to drive the API by hand:
irdb.postman_collection.json — every endpoint exposed by the api container.irdb-local.postman_environment.json — variable slots for baseUrl, the four token kinds, and chained ids.The collection mirrors the spec at /api/v1/openapi.yaml and the routes registered in api/src/App/AppFactory.php.
docker compose up -d from the repo root. The api listens on http://localhost:8081.irdb.postman_collection.json and irdb-local.postman_environment.json. Select the IRDB Local environment.Mint an admin token from the host (no Postman variable needed yet):
docker compose exec api php bin/console auth:create-token --kind=admin --role=admin
The raw irdb_adm_… token is printed to stdout and shown only once. Paste it into the environment's adminToken variable. Available roles are viewer, operator, admin. Run docker compose exec api php bin/console --help to see the full set of console commands (db:migrate, auth:bootstrap-service-token, jobs:run, jobs:status, scores:rebuild).
{ "status": "ok", … }.The collection's default auth is Bearer {{adminToken}}. Per-folder overrides apply for the public, auth and internal-job endpoints.
| Folder | Auth used | Variable |
|---|---|---|
| Health & Docs | none | — |
| Public — Reporter | Bearer {{reporterToken}} |
reporterToken |
| Public — Consumer | Bearer {{consumerToken}} |
consumerToken |
| Auth API (UI BFF) | Bearer {{serviceToken}} |
serviceToken |
| Admin — * | Bearer {{adminToken}} (collection-level) |
adminToken |
| Internal Jobs | Bearer {{internalJobToken}} |
internalJobToken |
Admin endpoints also accept a service token plus an X-Acting-User-Id header. To use that flow with the collection:
serviceToken variable to the value of the UI_SERVICE_TOKEN env var.actingUserId to the user id you want to act as (POST /api/v1/auth/users/upsert-local returns one).Bearer {{serviceToken}} and tick the disabled X-Acting-User-Id: {{actingUserId}} header (it is included on every Admin request, just disabled by default).The audit log will attribute these calls to actor_kind=user with actor_id=<userId>, exactly as the UI does in production.
Tests in the collection capture useful ids back to environment variables, so this sequence works without manual copy/paste:
policyId (prefers moderate).reporterId.policyId, populates consumerId.reporterToken directly.consumerToken directly.ip_scores.Run that loop end-to-end and you have exercised the report-and-distribute golden path.
Token creation responses include raw_token once and only once. The collection's test scripts mirror it into:
lastRawToken (always)reporterToken (on kind=reporter)consumerToken (on kind=consumer)If you create an admin-kind token via the UI / collection, copy lastRawToken into adminToken to swap auth.
/internal/* endpoints are bound to loopback and RFC1918 by the api's Caddyfile and return 404 from any other source. Run Postman on the same host as the api container (or inside the Docker network), not from a workstation calling a public hostname.