API query invalid in SnapLogic, but valid in Postman
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2021 06:40 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2021 06:54 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2021 07:41 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2021 07:51 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2021 07:18 AM
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.