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

API query invalid in SnapLogic, but valid in Postman

Garrett
New Contributor II

Split out from: 401 Error using Https in API REST GET call

Did you ever solve your issue?

I am experiencing something similar. To answer the question the User-Agent can be anything. Something like SnapLogic/version# replacing the number.

My issue is that when I run it in Postman I get results.
When I run it in SnapLogic the Server is saying that the query is invalid.

17 REPLIES 17

debra_paponette
New Contributor

To this date nope. i have tried everything from create an SSL rest account and I am still getting the issue. The API works in postman and the browser but not the rest snap. I am out of ideas at this point

I was told to try something like this and it is working.

My rest API requires a query parameter.

http://ServiceURL?query=select * from table where id=1234

I had put in the URL into the Service URL box and then added a query parameter called query.

That did not work.

What does work is this:

โ€˜https://ServiceURL /services/?query=โ€™ + encodeURIComponent(โ€˜select * from incidents where id < 1000โ€™)

And that entire line went into the ServiceURL.

Seems that they do not fix the encoding in the query parameters.

Set the Service URL to โ€œhttps://ServiceURL/servicesโ€ and use the โ€œQuery parametersโ€ table to set the query parameters. See the docs for this snap.

Garrett
New Contributor II

That is what I tried but it did not work without adding the encodeURIComponent function on the query.

My endpoint said that there were invalid characters when I did it as the document shows.

I tried putting the encodeURIComponent function into the query parameter but it doesnโ€™t evaluate the function it sends it as text to the endpoint instead.