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!