API Gateway (prod)

Rest Api

Documentation

The Rest API is documented using the OpenAPI 3.0 standard. Documentation can be found at the given website: https://api-dtm.prod.pansa.io/swagger-ui

Authentication

The Rest API is secured using the OAuth 2.0 standard. To consume data from a given endpoint, add an Access Token to every request:
   
 curl \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  https://api-dtm.prod.pansa.io/api/operators
   

To get Access Token you need to use a Secret for a registered client. The following example shows how to get an Access Token using curl:

   
 curl \
  -d "grant_type=client_credentials" \
  -d "client_id=$API_CLIENT" \
  -d "client_secret=$API_CLIENT_SECRET" \
  https://sso.uav.pansa.pl/auth/realms/api/protocol/openid-connect/token
   

And the response looks like this:

   
{
  "access_token" : "eyJhbGc....",
  "expires_in" : 300,
  "refresh_expires_in" : 0,
  "refresh_token" : "eyJhbGc...",
  "token_type" : "Bearer",
  "not-before-policy" : 0,
  "session_state" : "f2a923a6...."
}
   

Note that the Access Token has a short time to live ("expires_in" : 300 - these are seconds). Remember to generate a new one before the old one expires.

Versioning

Api is versioned using the Accept header as shown below.

   
 curl \
  -H "Accept: application/register.v1+json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  https://api-dtm.prod.pansa.io/api/operators
   
        

In case the header Accept is omitted, the latest version of the API is used.