Tenancy
Regardless of which API is being consumed or which flow has been used, a client must also specify a tenant in its request. Authorized tenants can be retrieved via a GET request to ~/v1/tenants, ensuring a valid token is included in the authorization header as a Bearer token.
The tenants endpoint will respond with a JSON array of authorized tenants based on the credentials provided
[
{
"Id" : "6E02F2D1-E21A-4CAC-897F-16CEE262FBFC",
"Name": "My Consultancy Ltd"
},
{
"Id" : "9A8A6744-F2AC-427F-9115-216DC0A86FEA",
"Name": "Demo Architecture"
},
]
The relevant tenant id must then be sent as a tenant_id
header in each subsequent request. eg:
GET /v1/user HTTP/1.1
HOST: api.cmaphq.com
tenant_id: 6E02F2D1-E21A-4CAC-897F-16CEE262FBFC
Authorization: *****
Specifying multiple tenants is not supported, and failing to provide the header will result in a 403 (Forbidden) response
Note that these IDs are immutable, and can be stored in configuration if desired, rather than performing the request programmatically in the consumer before each connection.