Hi
I want to send a request from the pre-request Script but my endpoint uses API Key as headers to access, so I have next:
and the next code
function sendRequest(name){
pm.sendRequest({
url: (pm.collectionVariables.get("baseUrl") + "/companies"),
method: 'POST',
headers: {
'sn-api-key': pm.collectionVariables.get("snApiKeyInternal"),
'sn-api-secret': pm.collectionVariables.get("snApiSecretExternal")
},
body: {
mode: 'raw',
raw:JSON.stringify(name)
}
},(err,response) => {
console.log(response);
});
}
but Iām getting a 401 error. Any idea?
Thanks in advance.