hi guys
can anyone help me, please.?
need to send a POST request with Authorization
header
Website API docs says that:
All requests to resources (excluding the schema pages) must be accompanied by a correct Authorization
header as per this specification. The header looks like this:
Authorization: MAC id=“your API key”, ts=“1325376000”, nonce=“random-string”, mac=“base64-encoded-hash”
So i created a variable in Pre-Request script (replaced real API to dummy API ):
pm.globals.set("authorization", [JSON.stringify({
'MAC id':"5b256cdee0baa77d57a4406fe957787b",
'ts': pm.variables.get('ts'),
'nonce':pm.variables.get('nonce'),
'mac':pm.variables.get('mac'),
})]);
and then add authorization variable as Access Token
Request isnt going through
Access Token is being read as {“MAC id”:“5b256cdee0baa77d57a4406de9888b”,“ts”:“1648775596200”,“nonce”:“126955720907400”,“mac”:“t3MRycjMO9hJdp9GmGKSlph4s15dKaTRKzDtLttjFfw=”}
as it was passed as an object (then json stringified)
Should it be passed exactly as docs say , so equal signs instead of colon?
MAC id=“your API key”, ts=“1325376000”, nonce=“random-string”, mac=“base64-encoded-hash”
I am not sure how can I achieve that. Is there a special method for that in postman?
or should it be passed a object, so something else is incorrect in my code?
Cheers!