cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

JSON input to a REST POST call failing

wani-amol
New Contributor III

Hello All,

I am trying to send a json document as input in the body of a REST POST call. The configuration of the REST Snap is in the image attached below. I am getting a 401 error, โ€œREST API service endpoint returned error result: status code = 401, reason phrase = Unauthorized, refer to the error_entity field in the error view document for more detailsโ€
I ran the same call in Postman and it worked just fine. It would be really great if someone could help me configure the Snap right to make it work. Thanks!1 2 3 4

4 REPLIES 4

stephenknilans
Contributor

I think most apis have no way of passing/remembering the authorization, and postman gets away with this by having an option to set the headers:

image

On MY example here, I would have to call the API with the logon sequence, parse the access token out, and replace {{accessToken}} with that value. You can test all that with a copy of the reference in postman. Also, check the headers, and make sure you are passing all of the needed ones, and no improper ones.

On your example, you would have to add the header as an โ€œHTTP headerโ€ on the REST call. I believe that is the way many work. SOME work by typing the ip to the login, but even then you have to login, in some way.

tlikarish
Employee
Employee

Another way of authenticating and authorizing an HTTP requests is through an account. The REST Post snap can use these accounts:

image

Otherwise, youโ€™ll probably need to configure the snap with the correct method of auth for that end point.

wani-amol
New Contributor III

Thanks for the help! I played around with the configuration as per the documentation and the REST POST worked. The Oracle environment we were trying to push the data to was being refreshed which was partially the reason for the errors.

emmanuel001
New Contributor

When configuring a REST Post of the mailjet API, it indicates the following message.

Error:
Reason: REST API service endpoint returned error result: status code = 403, reason phrase = Forbidden, refer
to the error_entity field in the error view document for more details
Resolution: Please check the values of Snap properties.

Error Fingerprint[0] = efp:com.snaplogic.snap.api.rest.89xhsFt7

image

image

image

image

When performing the test in Postman, the execution is correct

image