Forum Discussion
New API Endpoint with DAX Queries
- 5 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