If you want to connect to FieldClimate API with HMAC, you have to use the Pre-request Script on Postman.- The yellow highlighted variables are to be edited according to your needs and keys.
- We use the environment variable api.v2, which is set to https://api.fieldclimate.com/v2/.
- In the example below we run a HTTP GET request.
- The API route /user/stations is just an example, any other route is possible, but params (method and request) are to be changed accordingly.
- Your private and public HMAC key pair can be obtained on https://fieldclimate.com > user menu > API services > FieldClimate, copy paste the keys from there to the script as indicated below:
The Pre-requested Script for your request can look like this:

Here another example of the params section in the script for another route:

You can copy paste the script from here for use and editing:
let params = {
"method" : "GET",
"request": "/user"
}
const method = params.method
const body = params.body
const public_key = "YOUR_PUBLIC_KEY";
const private_key = "YOUR_PRIVATE_KEY";
const timestamp = new Date().toUTCString();
const content_to_sign = params.method + params.request + timestamp + public_key;
const signature = CryptoJS.HmacSHA256(content_to_sign, private_key);
const hmac_str = 'hmac ' + public_key + ':' + signature;
pm.environment.set("hmac", hmac_str);
pm.environment.set("ts", timestamp);Header entries "Authorization" and "Request-Date" are to be added:

Including the default headers, the entries may look like this:

Remaining tabs:
+ Params: empty
+ Authorization: No Auth
+ Body: none, depends on the request of course, in the examples above we dont send data, therefore the body empty
+ Tests: empty
+ Settings:

If you have any questions or need additional help, please submit a ticket to our Support team at METOS® support center, informing: - Username or HMAC Public Key or Oauth 2.0 Client ID. - Device ID and affected time period. - Full request details (method, URL, payload). - Full response details (status code, message, result). - Screenshots, if available.