Forum Discussion
New API Endpoint with DAX Queries
- 4 years ago
I finally got this partially worked out with the help of one of the very helpful Power BI engineers. For some reason datasets in My Workspace don't seem to be getting proper build permissions, so I decided to switch to just testing datasets in my v2 workspaces.
I initally thought that I had to use the format https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId} because that is what I'm accustomed to doing. This will probably change as this gets closer to GA, but for now you actually just remove the parts about the group and reference the dataset directly. For example: https://api.powerbi.com/v1.0/myorg/datasets/f388a618-2c93-41c5-8528-44c0c1129d70/executeQueries
Once I made that change, I was able to return data from a Powershell script and Postman. Still not sure about the permssions in My Workspace, but I'll likely never use that anway.
Hi All,
Can someone pls point to what is missing in my approach.I spent lot of time trying to fix this but i coundt so far.
I tried a lot of things but i got a different error now and not sure of the reason.I was able to run dataset refresh and GET methods but unsuccessful with this "executing of DAX"
Error:
Error is constantly pointing to something wrong at the client end request and i am not sure what more to fix.
Here is my code:
I tried the same with refreshes endpoint as below and the service principal was able to refresh the dataset.
# refresh
$uri = "https://api.powerbi.com/v1.0/myorg/groups/$GroupId/datasets/$DatasetId/refreshes"
Invoke-RestMethod -Uri $uri –Headers $headers –Method POST –Verbose
Note:
- I also used -Headers in the executequeries rest api but it didnt make a difference
- I registered an Azure app ,obtained the AppID,secretvalue,tenantID.I provided dataset.read and write permission for the app to call REST api.
- I created an AAD security group and added the service principal account into it as a member.
- Installed and imported all MicrosoftPowerBIMgmt modules in powershell
- Service principal is granted Admin on the dataset it is trying to query.
- Workspace is V2
- rjhale4 years agoHelper V
I think you're running into the same problem that I was. Please look at my reply from 8/19. You can't use the URL with groups/groupid in it. For now, you have to reference the dataset without that information. For example: https://api.powerbi.com/v1.0/myorg/datasets/f388a618-2c93-41c5-8528-44c0c1129d70/executeQueries
- Anonymous4 years agoNot applicable
I already tried that abs URL method and it doesnt work either.I get the same 400 (bad request) error.
Could you please provide all the steps you took to get this working end to end.It will be very helpful for many of us.
- rjhale4 years agoHelper V
For testing purposes, I was simply using PowerShell to authenticate and get a bearer token with my own credentials in the exact same way that Kay outlined in the Power BI blog post from last month. I would start troubleshooting by making sure you can use your own creds to return data from that dataset using the excecuteQueries endpoint.
You could also try using the "Resolve-PowerBIError -Last" command in PowerShell to see if you can get more information about where the invoke method is going wrong. Just a thought.