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

Do you have the โ€œ=โ€œ sign enabled to make it evaluate as an expression and not just plain text?

Garrett
New Contributor II

I get this error:

Could not compile expression: https://serviceurl โ€ฆ (Reason: Encountered extraneous input โ€˜:โ€™ at line 1:5; expecting={, โ€˜||โ€™, โ€˜&&โ€™, โ€˜^โ€™, โ€˜==โ€™, โ€˜!=โ€™, โ€˜>โ€™, โ€˜<โ€™, โ€˜>=โ€™, โ€˜<=โ€™, โ€˜+โ€™, โ€˜-โ€™, โ€˜*โ€™, โ€˜/โ€™, โ€˜%โ€™, โ€˜?โ€™, โ€˜instanceofโ€™, โ€˜inโ€™, โ€˜matchesโ€™, โ€˜[โ€™, โ€˜(โ€™, โ€˜.โ€™, PropertyRef}; Resolution: Please check expression syntax)

Query parameter looks like this:
image

incase the image doesnโ€™t work:

Query parameter | Query parameter value
query | encodeURIComponent(โ€˜select * from mytable where id < 1000โ€™)

using your expression I am seeing this result:
Screen Shot 2021-01-29 at 9.16.58 AM

It is not necessary to use encodeURIComponent. The REST Get snap will properly encode the query parameter values. Can you please show the full configuration of your REST Get snap?

I also have to say that providing a REST service which accepts a SQL command to execute against your database seems like a rather significant security vulnerability.