Examples
Token generation and basic flow for private customer
- Generate JWT token using your client_id and client_secret
- Insert a person to the database
- PCI is now scanning various registries to get payment channels for customers
- Get person by id
curl -X POST 'https://auth.infotorg.no/auth/realms/bds-realm/protocol/openid-connect/token' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'grant_type=client_credentials&scope=pci-user&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET'Example response:
{ "access_token": "<token>", "expires_in": 3600, (...) }
curl -X POST "/api/v1/people" \ -H "Authorization: Bearer <token>" -d "{\"id\":\"71241681\",\"address\":\"Langenfelder Strasse 22f, Hamburg\",\"country_code\":\"NO\",\"date_of_birth\":\"1989-06-01\",\"first_name\":\"Ola\",\"last_name\":\"Doe\",\"post_code\":\"1001\"}"
It is an asynchronous process. You may expect first channels few minutes after inserting customer, but for large (100k+) customer bases it may even take few hours to scan all registries.
curl -X GET "/api/v1/people/71241681" \ -H "Authorization: Bearer <token>"Example response:
{ "id": "71241681", "channels": [ "jtta", "vipps" ], "consents": [ { "channel": "jtta", "address": "12345678" }, { "channel": "vipps", "address": "987654321" } ], "created_at": "2020-09-25T21:21:04.327041Z", "updated_at": "2020-09-25T21:26:18.093286Z" }
Changed end customers and Pagination
- Get first batch/page of updated people (private customers)
- Repeat step 1 until customers array in the response is empty
- Every few minutes/hours check for changes: repeat step 1 with cursor parameter:
curl -X GET "/api/v1/people?preferred_page_size=100" \ -H "Authorization: Bearer <token>"Example response:
{ "cursor": "2099-07-09T18:37:00.199269Z", "next_cursor": "2020-09-25T21:29:18.14467Z", "customers": [ { "id": "71241681", "channels": [ "jtta", "vipps" ], "consents": [ { "channel": "jtta", "address": "12345678" }, { "channel": "vipps", "address": "987654321" } ], "created_at": "2020-09-25T21:21:04.327041Z", "updated_at": "2020-09-25T21:26:18.093286Z" } ] }
next_cursor is a time-based cursor, which should be used for next GET operation, so that you get only incremental changes.
curl -X GET "/api/v1/people?cursor=2020-09-25T21:29:18.14467Z&preferred_page_size=100" \ -H "Authorization: Bearer <token>"Example response:
{ "cursor": "2020-09-25T21:29:18.14467Z", "next_cursor": "2020-09-25T21:33:13.093286Z", "customers": [] }
Deleting customer
In case customer should no longer be washed it should be removed from the database
curl -X DELETE "/api/v1/people/71241681" \ -H "Authorization: Bearer <token>"HTTP 200 (ok) will be returned, or 404 (not found) if customer was not found for given id.