I'm trying to call the powerbi api for a specific dataset, just to prove to myself that i have security set up correctly.
Ultimately, I will need to make a DAX query from code but to start, i'm using postman to make some basic request to ensure I've set things up correctly.
What Works
In the online app (app.powerbi.com), I can do the following (using my user credentials - aka I log in):
https://app.powerbi.com/groups/{groupid}/datasets/{datasetid}/details?experience=power-bi
This renders my table with all the columns / data.
What doesn't work
In postman, i'm trying to retrieve the data from the api like this:
https://api.powerbi.com/v1.0/myorg/groups/{groupid}/datasets/{datasetid}
But when I do, I get the following error:
{
"error": {
"code": "PowerBINotAuthorizedException",
"pbi.error": {
"code": "PowerBINotAuthorizedException",
"parameters": {},
"details": [],
"exceptionCulprit": 1
}
}
}
I also tried to do a POST with a DAX query like this:
https://api.powerbi.com/v1.0/myorg/datasets/{datasetid}/executeQueries
with a body:
{
"queries": [
{
"query": "EVALUATE VALUES('Test Table')"
}
]
}
But I get the error:
{ "error": { "code": "PowerBIEntityNotFound", "pbi.error": { "code": "PowerBIEntityNotFound", "parameters": {}, "details": [], "exceptionCulprit": 1 } } }
Setup
I have created an application registration in azure called powerbi with the following permissions:
And then on the actual dataset, i have the following under "sharing"
What I've tried so far
I've searched here on stack and found another post saying that I should decode the JWT token created for my app registration and make sure there's no roles embedded. I didn't see any field called role(s).
I also tried this request to the api: https://api.powerbi.com/v1.0/myorg/datasets/{datasetid}/refreshes
{
"Message": "API is not accessible for application"
}
and the error I get there is:
Questions
In addition to the obvious question of why my calls to the API are failing, I'd like to doublecheck whether or not i need to include "myorg" in the Uris? Is it supposed to be a literal? or am i supposed to substitute it with another id? (like group id?).
According to MS's documentation, it seems to be a literal. Usually, for variables, they use the "{}" syntax to indicate.
What am I missing? Please and thanks.
myorg
. In Postman, are you sending any Authorization tokens? See Power BI REST API: What It Is & How to Use It + Examples - see steps 2 & 3.myorg
is literal.