cancel
Showing results for 
Search instead for 
Did you mean: 

What is the escape char for rest api execute queries in postman

Hi all,

When send the following request in Postman:

POST Body:

{
"queries": [
{"query""EVALUATE COUNTAX(FILTER('Activity',[Activity Status]=\"Completed\"), [Priority])"
}
],
"serializerSettings": {
"includeNulls"true
}
}
 
Got this error in Response:
{
"error": {
"statusCode"0,
"errorCode""QueryUserError",
"message""Query (1, 1) The expression specified in the query is not a valid table expression.",
"errorDetails": [
{
"code""AnalysisServicesErrorCode",
"detail": {
"type"1,
"value""3241803862"
}
}
]
}
}
 
Basically, this is my query: 
EVALUATE COUNTAX(FILTER('Activity',[Activity Status]="Completed"), [Priority])
How do I escape the '"' inside the body of the request. Is it '\', or something else?
 
Thanks!
Status: New
Comments
v-robertq-msft
Community Support

Hi,

Why do you need to escape the '"' inside the body of the request? Have you tried to delete the “\” in the Post body and check if the response can be correct?

 

Best Regards,

Community Support Team _Robert Qin

weiyu_chen
Frequent Visitor

Hi Robert,

Thanks for the comment. Yes, I have tried "\", but I got any error message:

{
"error": {
"statusCode": 0,
"errorCode": "QueryUserError",
"message": "The end of the input was reached.",
"errorDetails": [
{
"code": "AnalysisServicesErrorCode",
"detail": {
"type": 1,
"value": "3238920193"}}]}}
 
For the query in Body:
{
"queries": [
{"query": "EVALUATE FILTER(Activity, [Actual End] >= dt\"2020-1-1T00:00:00\" && [Actual End] < dt\"2020-2-1T00:00:00\" "
}
],
"serializerSettings": {
"includeNulls": true
}
}
 
If I use date and time function instead of dt, it's fine. Body as:
{
"queries": [
{"query": "EVALUATE FILTER(Activity, [Actual End] >= (DATE(2020,1,1) + TIME(0,0,0)) && [Actual End] < (DATE(2020,2,1) + TIME(0,0,0)))"
}
],
"serializerSettings": {
"includeNulls": true
}
}
Thanks for the help.
Weiyu
weiyu_chen
Frequent Visitor

Hi Robert,

Here is another example:

{
"queries": [
{"query": "EVALUATE COUNTAX(FILTER('Activity',[Activity Status]=\"Completed\"), [Priority])"
}
],
"serializerSettings": {
"includeNulls": true
}
}
Got the following error in response:
{
"error": {
"statusCode": 0,
"errorCode": "QueryUserError",
"message": "Query (1, 1) The expression specified in the query is not a valid table expression.",
"errorDetails": [
{
"code": "AnalysisServicesErrorCode",
"detail": {
"type": 1,
"value": "3241803862"
}
}
]
}
}
Thanks,
Weiyu
v-robertq-msft
Community Support

Hi, 

According to the error message “The expression specified in the query is not a valid table expression.”. It seems to mean that you have to use the table expressions if you want to use the “EVALUATE” to query some results.

Therefore, I suggest you to follow this link to use the table expressions to create the formula:

https://docs.microsoft.com/en-us/dax/table-manipulation-functions-dax

 

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin