APIs
Client Domain Rest APIs
Description of the design and implementation of the APIs
Swagger

| Service | Environment | Docs |
|---|---|---|
| client domain api | non-prod | api docs |
| client id mapper api | non-prod | api docs |
Postman
Client Domain
Client ID Mapper
Publishing API to HCP
To publish the API to HCP, the following steps need to be followed:
- Login to the HCP API Management Console, ensuring that the resource group for the API being published is selected from the dropdown at the top of the page.
- Click the
Register APIbutton - Upload the Open API specification in either JSON or YAML format
- Complete the API metadata information form
- enter the required
Title,Slug,Version, andDescriptionfields - select the appropriate
Package/Subpackage - choose the radio button to indicate if you want the API displayed in the API Catalog
- enter an optional short description
- enter a full description
- click the
Nextbutton
- enter the required
- Complete the form to configure instances for prod and/or non-prod (use the
Delete Instancebutton to delete the Prod environment instance if you only want to register a non-prod instance)- enter an optional
Read/Write Timeout(default is 1000 ms) - enter an optional
Connection Timeout(default is 500 ms) - enter the Backend Targets
Host - enter the Backend Targets
Port(default is 443) - enter an optional Backend Targets
Path - select a Backend Targets
Location(e.g.azure-centralus,aws-us-east-1,hcp-elr) - enter the Backend Targets
Weight(default is 100)
- enter an optional
Field Descriptions
| Syntax | Description |
|---|---|
| Title | A title for the API |
| Slug | A unique name for the API that will be used in the gateway path behind the package/subpackage |
| Version | The version number for the API |
| Package/Subpackage | The package and subpackage of the API (Financial / Commerce for client Domain API) |
| Display in API Catalog | Select this option to display the API in API Catalog |
| Short Description | An optional field used for description of the API (the maximum number of characters allowed are 200) |
| Description | A detailed description of the API |
| Gateway Endpoint | An endpoint for the API |
| Read/Write Timeout | A timeout value for read/write |
| Connection Timeout | A timeout value for connection |
| Host | The host of the backend |
| Port | The port that the service is listening on, default value is 443 |
| Path | The path of the URL that gateway will proxy to |
| Location | The cloud provider and region to which requests will run through a kong data plane. This should be where the upstream service is hosted. |
| Weight | A number [0-100] which is used for balancing traffic between multiple backends |
| Global scopes | Global scopes grant access to all paths and operations of the API, regardless of what is defined at a path/operation level |
| Path operation scopes | Path operation scopes grant access to individual path and operations |
Oauth2.0 Client Credentials
To successfully make requests to the Client Domain endpoints, an OAuth token must be generated. To generate the token, the following steps need to be followed:
Generate a
client_idandclient_secretby visiting the Identity & Access Management page and selectingOAuht2 Clients. Select the Resource Group for which theclient_idandclient_secretshould be added, and generate theclient_idandclient_secret, noting the values for the next step.Generate a temporary
access_token. The token generation call is the first out of two steps to successfully authenticate to an OAuth Client Credentials protected API. Theaccess_tokenissued on a successful request is valid for theexpires_intime (seconds), and can be used successfully within that window.curl --request POST \
--url https://api-stg.uhg.com/oauth2/token \
--header 'content-type: application/x-www-form-urlencoded' \
--data client_id=[Client ID issued by Digital Identity] \
--data 'client_secret=[Client Secret issued by Digital Identity]' \
--data grant_type=client_credentials \
--data scope=https://api.uhg.com/.defaultSuccessful Token Generation Response
{
"token_type": "Bearer",
"expires_in": "3599",
"ext_expires_in": "3599",
"expires_on": "1636039992",
"not_before": "1636036092",
"resource": "00000002-0000-0000-c000-000000000000",
"access_token": "[JWT Access Token]"
}Pass the
access_tokento Stargate upon successful token generation, by adding a request headerAuthorization: Bearer <access_token>to the proxy call.
Authorization: Bearer <access_token>
note If the environment is not a production environment and the X-Upstream-Env header is omitted, a response
body of "message": "no Route matched with those values" will be shown.