I have a API call that takes a POST body of
raw: {"category":1, "fmipstatus":true}
and it is of type JSON.
Content-Type is application/json
I use Postman to send this API call and I get a 200 response code.
I want to code this call as part of a Postman Pre-request Script
I have the following:
method: 'POST',
header: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Basic NDc0OmVmMzAwZThkNGFjNTQ2ZjU3ZjhjYWQ5ZWQwMjUyNGIxYTI5NmQwM2M='
},
body: {
mode: 'raw',
raw: JSON.stringify( {category: 1, fmipstatus: false} )
}
I always a 401. In the first API through Postman, if I put garbage in there, I also get a 401 response code.
So I am thinking somehow in my Postman script, the body is defined incorrectly.
Does anyone the error?