Call to API not working in REST Message. Works in Postman though. Any suggestions?

nick0989
Tera Contributor

I'm using a REST Message with PATCH method and I haven't been able to get a successful test. However, within Postman I am able to send the PATCH with raw JSON. All i'm doing is setting the Authorization bearer token and sending raw JSON through the body.

In the REST Message I set the two headers...Authorization and Content-Type. Authorization is set to the authentication token and content type is application/json.

If I change the raw JSON in Postman to "text" or something else, the call doesn't work. I assume this is the reason why the REST Message isn't working.

 

r/servicenow - Call to API not working in REST Message. Works in Postman though. Any suggestions?

Here's the rest message with all the variables.

 

r/servicenow - Call to API not working in REST Message. Works in Postman though. Any suggestions?

${body} is just an array of objects.

${auth} is the access token

I have default values for each variable to test with.

Why is this working in Postman but not in the REST message? How do you send raw JSON through the REST Message? I have a feeling that's what the issue is but i'm not 100% sure.

2 REPLIES 2

Tony Chatfield1
Kilo Patron

Hi, unfortunately with no details of the body or how it's generated & constructed, I don't think it possible to assess the issue.
Have you tried using REST API explorer to generate similar message\provide some insight into format?
perhaps you could update this thread with details of your body & payload construction.

Turns out, when you get the access token and set it in the Authorization header, you have to at the prefix of "Bearer ". Then you can concatenate the access token.