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

REST PUT - Where to put Body Message

aemery
New Contributor

Hello,

I have a REST service that first requires a PUT with a JSON body with the username/password in the body, and it will return a key. I can get it to work in SoapUI and Postname, but am unable to figure out how to make it work in Snaplogic.

I constructed what was used as the Body in Postman in the JSON Generator snap -

[
{
โ€œusernameโ€: โ€œsomeuserโ€,
โ€œpasswordโ€: โ€œsomepasswordโ€
}
]

However how do I call that from the REST Put snap?

Thanks in advance for any assistance.

5 REPLIES 5

j_angelevski
Contributor III

Hi @aemery ,

You can put any JSON you want in the Rest PUT snap in the HTTP Entity setting.
image

aemery
New Contributor

Ok, so I put this JSON (user/pass redacted) in the HTTP Entity field -
{โ€œusernameโ€: โ€œUSERโ€, โ€œpasswordโ€:โ€œPASSโ€}

image

This is the same JSON string that works when I use Postman or SoapUI.

And I got this error -
Provided JSON is incorrect

Resolution:

Please ensure that the provided JSON is correct

Reason:

Unexpected character (โ€˜Cโ€™ (code 67)): Expected space separating root-level values at [Source: (String)โ€œ1CE2D9161EF94E548076FAD3BCA6A4F7โ€; line: 1, column: 3]

j_angelevski
Contributor III

You need to enable the expression field if you want to use json inside the http entity setting. ( Just click on the = sign ). If you donโ€™t enable the expression, then everything inside this property will evaluate to a string, which is why the error is telling you that you provided incorrect JSON.

ok, that got me further, however the service returns a text/plain object so now Snaplogic gives an error saying it is expecting JSON. I set the following so that it would accept any object -

Accept = */*

Edit: the asteriks were removed from the post