Carl Cimino
Carl Cimino

Reputation: 21

Cosmos Query Where Clause Issue in Postman

I can not get the Body to return results when using a where clause. It doesn't seem to like the values for f.RequestPath.

{      
    "query": "SELECT * FROM AppLogs f WHERE f.RequestPath in ("/payments/post-sales", "/payments/pre-sales", "/payments/refunds", "/payments", "/Payments")"
}

Postman Error Message After adding Where clause

The Query works when just do this. I think it might have something to do with the slashes in the Requestpath values but don't know how to resolve that. Do you need to use escape characters? How would you do that? Any help would be appreciated.

{      
    "query": "SELECT * FROM AppLogs f WHERE 1=1"
}

Query Works without the Where clause for Request Path

Upvotes: 1

Views: 119

Answers (1)

Gaurav Mantri
Gaurav Mantri

Reputation: 136334

Please try by replacing double quotes in your query with single quotes. Something like:

{      
    "query": "SELECT * FROM AppLogs f WHERE f.RequestPath in ('/payments/post-sales', '/payments/pre-sales', '/payments/refunds', '/payments', '/Payments')"
}

UPDATE

As mentioned by @MatiasQuaranta in the comments, you can also escape the double quotes in you query by doing something like:

"query": "SELECT * FROM AppLogs f WHERE f.RequestPath in (\"/payments/post-sales\", \"/payments/pre-sales\", \"/payments/refunds\", \"/payments\", \"/Payments\")"

Upvotes: 2

Related Questions