Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Jai0110
Frequent Visitor

Execute Queries via API

Hi All, I am trying to execute a query through the rest api documentation. Below is my sample json body. It is a simple Query which runs with no issues in desktop's DAX Query View but it is throwing error when called via API. I believe this is due to the use of "TableID" which is present inside double quotes. Please help me resolving this
Sample Body:

{
"queries": [
{
"query": "EVALUATE
var _a = SELECTCOLUMNS(INFO.TABLES(),"TableID", [ID])
var _b = SELECTCOLUMNS(INFO.TABLES(),"TableID", [ID])
Return UNION(_a,_b)"
}
],
"serializerSettings": {
"includeNulls": true
},
"impersonatedUserName": "someuser@mycompany.com"
}

--------------------------------------------------------------

Response:

{
"error": {
"code": "BadRequest",
"message": "Bad Request",
"details": [
{
"message": "Invalid value",
"target": "request.queries[0].query"
},
{
"message": "'request' is a required parameter",
"target": "request"
}
]
}
}

1 ACCEPTED SOLUTION
BernatAgullo80
New Member

You probably need to double the double quotes, or escape the quotes with \

have you tried it?

View solution in original post

4 REPLIES 4
Jai0110
Frequent Visitor

Thanks using "\" helped. But is there anyway to run the query without escaping the double quotes with "\" ?

BernatAgullo80
New Member

You probably need to double the double quotes, or escape the quotes with \

have you tried it?

Can you please share the Library you have used?

Thanks using "\" helped. But is there anyway to run the query without escaping the double quotes with "\" ?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.