Skip to content

Setting up Postman

In this step-by-step guide we will create a Postman Collection from our OpenAPI specification - and set up authentication.

img_2.png
Our OpenAPI spec is available for download in our API Reference.

What if it changes?

If the OpenAPI spec changes, you will have to change your collection as described in the API Reference, or you will have to go through this guide again.

img.png
For demonstration purposes, we are starting with a blank new workspace in Postman
img_1.png
Let's import the OpenApi Spec
img_3.png
Paste the link to our OpenAPI Spec, or upload - if you downloaded it.
https://docs.hubocean.earth/openapi/redoc/openapi.json
img_5.png
Click View Import Settings, there are some things we want to set so that Postman knows how to convert the spec properly.
img_8.png
Set parameter generation to Example
img_7.png
Folder Organization should be set to "Tags" because of how we have categorized the requests.
img_6.png
Make sure always inherit authentication is on, or else it will be hard to set up authorization later.
img_9.png
Now click the arrow to go back to save the settings.
img_4.png
Click import.
img_10.png
Now we have all the requests converted into a Postman Collection.
img_12.png
Let's set up auth. Click the top level of the collection, and then the authorization tab.
img_13.png
Select OAuth 2.0

Then, under Configure New Token, add these variables:

Token name:

ODCAT PROD

Set Grant Type to Implicit.

If you are using the Postman Desktop app, set Callback URL to:

https://oauth.pstmn.io/v1/callback

Set Auth URL to:

https://oceandataplatform.b2clogin.com/oceandataplatform.onmicrosoft.com/b2c_1a_signup_signin_custom/oauth2/v2.0/authorize

Set Client ID to:

87537127-da36-4326-bc54-f120f40c9665

Set Scope to:

https://oceandataplatform.onmicrosoft.com/odcat/API_ACCESS offline_access
img_26.png
The new token configuration should now look like this
img_17.png
And now, very importantly, click save, that way the authentication settings will be used for all the endpoints.

Inheriting Authentication

When we toggled on "Always inherit authentication" while importing the collection, the enpoints will inherit the same authflow as the one above it. So by saving the auth flow in the root object of the collection, it wil proapagate down to all the endpoints.

img_16.png
Scroll all the way down, and click Get New Access Token
img_19.png
A window should pop up and prompt you for your credentials.
img_20.png
After clicking log in, this window should appear.
img_21.png
Now that your token has been created, click Use Token to store it in Postman.
img_23.png
Token has been added, and will be used for requests.
img_25.png
A good endpoint to test is listing all resources in the catalog. Just find it, and click send.

Parameter generation

Since we set Parameter Generation Setting to Example when we imported the OpenAPI spec, the request body here is ready to use. This request example will always work, but most examples need some changes to work with your scenarios.