Steps to Use CMD APIs
Sections
- Authentication token generation details
- Create a request and use API via Postman
Authentication token generation details:
| Environment | URL |
|---|---|
| PROD | https://api.maersk.com/oauth2/access%5Ftoken |
| PRE-PROD | https://api-stage.maersk.com/oauth2/access%5Ftoken |
| SIT | https://api-cdt.maersk.com/oauth2/access%5Ftoken |
Please Use the above URL to generate the auth token. How to generate it via postman will be shown in the next section
Creating a request and using API via Postman:
-
Please refer to this page to find API’s Details CMD Modernization API Path - Global Data and Analytics - Confluence (atlassian.net)
-
Link to API Sample JSON requests
-
Link to OAS Collection API-JSON-Schema-Definitions/apis/901-SMDS-CMD/v1-Bundled at master · Maersk-Global/API-JSON-Schema-Definitions (github.com)
-
Postman Configuration
- Create a new collection.
Select Type to OAuth 2.0 3. Navigate to Configure New Token section by scrolling to down. Now use the above-mentioned Auth token generation URL, Client Key and Client Secret as shown in next image 4. After Filling the above details Click on Get New Access Token Button. And you’ll get a Prompt to use the generated token as shown in below image. Click on use token button.
- Now Navigate to Pre-request Script section and add below script. Please use consumer-key from above mentioned details. pm.request.headers.upsert({ key: "Consumer-Key", value: {Place-holder for Consumer-key} }); pm.request.headers.add({ key: "Consumer-Key", value: {Place-holder for Consumer-key} }); pm.request.headers.upsert({ key: "API-Version", value: "1.1" }); pm.request.headers.add({ key: "X-MAERSK-5734F57632", value: "wDr5caKP4BcbaWPqAGVDBQkYrewv9TPc"}); pm.request.headers.add({ key: "X-MAERSK-IGNORE-CACHE", value: "true"});
-
Creating a Sample Request
- Under newly created collection create a new request with respective request HTTP method type, provide the URL and request details either body/path-variables/query parameters and hit the API. Example