I am working on a project that talks with an API, my script is in nodeJS (it's a big project so I will give you a very simplified version)
Essentially when I do a PUT request to the API, with the postman, it works fine, When I do it with my Code: GET works great (so I know the URL is correct), but PUT doesn't work with my script, I get no errors on my console, and the API simple sends back the OK status, so I have no clues where it went wrong
Here is a very basic version of my script (that doesn't work either)
(I know the URL is correct)
PUT parameters:
{ method: 'PUT',
baseUrl: 'https://fusionrv.XXXX.XX/fusion/apiservice',
url:
'XXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXX',
qs:
{ auth:
'AUTH_KEY',
value: 1 },
headers: { 'content-type': 'application/json' } }
simple code (without the imports):
request(putParams, (err, res) => {
if (err) console.log(err);
data = JSON.parse(res.body)
console.log(data)
});
In Postman, I have the same baseURL and url, as well as the same params "auth" and "value", the body is set to "none", and headers are Content-type: application/json.
The response (both in Postman and NodeJS):
{
"Status": "Success"
}
So does anyone know why it works with postman but not with the request module? I appreciate all of you!
qstobody? - vmf91