How to access the CDC API using POSTMAN?

,

1. Create an account and accept the terms of usage


Created an account on the https://cds.climate.copernicus.eu/ page using the Login/register section.

An email will be sent to the indicated email account in which the user is asked to set-up a password.

Using the email address and the password, the user can log in. As a result, the user-detail page (where one can see the UID and API Key) becomes available.


Warning!

The account is not yet fully functional, the user must first agree with the terms of the licence by reading and submitting it on the licence-to-use-copernicus-products page.



2. Use the UID and API Key to authenticate on Postman


The UID and API Key can be used in two different ways in order to provide authentication.


2.1. Authenticate using the Authorization tab


Create a request and on the Authorization tab, choose the Basic Auth type and input the UID (as username) and the API Key (as password),  as follows:




2.2. Authenticate using a request header


Otherwise, using the UID and API Key, a basic-authentication token can be generated,  as follows:
opening a browser page (Chrome, Edge, etc) and then the Developer Tools (by pressing the F12 key or by pressing the mouse right-button and then selecting "Inspect"), on the "Console" tab, by typing in (or copy/paste) the following content (replacing the uid and apiKey strings with the real values obtained above) and pressing "Enter".


encodedData = "Basic " + window.btoa('uid:apiKey')


The result should be something similar to the following image:


On the Headers tab, using the generated token, add a new entry, as shown below:

Authorization Basic dWlkOmFwaUtleQ==



3. Create a request


Open Postman and create a new request, i.e. reanalysis-era5-pressure-levels-preliminary-back-extension, using the token above as an authorization header:

https://cds.climate.copernicus.eu/api/v2/resources/reanalysis-era5-pressure-levels


The body of the request is a JSON payload as shown in the body.json file.


This content was created by running the same request in the web-application.



Consulting, then, the "Network" tab of the Developer Tools, both the request payload and response are visible.