Reply
Highlighted
Regular Visitor
Posts: 16
Registered: ‎02-29-2016
Accepted Solution

Updating parameters through the service API

[ Edited ]

We are using parameters to change our database dynamically in reports deployed to the Power BI service. It works great. Now I'd like to be able to do more through API calls as opposed to manually updating things in the service.

 

I'm using Postman for all my testing and can authenticate, and get a token, list groups, reports, and datasets, and even dataset parameters no problem, but when trying to make a call to update the parameter values I get an error, and I can't find any information about it.

 

Once authenticated I'm making the following call

https://api.powerbi.com/v1.0/myorg/groups/xxxmygroupidxxx/datasets/xxxmydatasetidxxx/Default.UpdateP...

 

with a json body of

{
  "updateDetails": [
    {
      "name": "DatabaseServer",
      "newValue": "xyz"
    },
    {
      "name": "DatabaseName",
      "newValue": "123"
    }
  ]
}

 

and it returns:

{
    "error": {
        "code": "InvalidRequest",
        "message": "This operation is only supported for the dataset owner"
    }
}

 

 

which I don't really understand as I am the dataset owner


Accepted Solutions
Frequent Visitor
Posts: 8
Registered: ‎01-23-2018

Re: Updating parameters through the service API

[ Edited ]

My guess is that you are NOT the same user when you use the APIs, as when you login to the portal. You probably are within the same tenant/group (as you can see the data), but not allowed to modify datasets in the way the owner can.

Do other “Write” APIs work for you? For example Update Datasources (see https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/updatedatasources)? I think you will get the same error.

 

You can try (via API, with the same authentication you do) to Take Over the dataset (https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/takeoveringroup) after that, you should be able to execute Update parameters. Also, if you then get into the Portal UI (with the original credentials you use now) and go to the Schedule Refresh page of the dataset, you will see who the owner is now (once you are not the owner, a line appears there saying “the dataset has been configured by …….. Would you like to take over the setting?”

 

Also, in the future when you post a request/response, please paste the entire raw data (you can remove the authentication token…) so we can see the request Id etc. and if necessary, investigate in our internal logging.

View solution in original post


All Replies
Frequent Visitor
Posts: 8
Registered: ‎01-23-2018

Re: Updating parameters through the service API

[ Edited ]

My guess is that you are NOT the same user when you use the APIs, as when you login to the portal. You probably are within the same tenant/group (as you can see the data), but not allowed to modify datasets in the way the owner can.

Do other “Write” APIs work for you? For example Update Datasources (see https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/updatedatasources)? I think you will get the same error.

 

You can try (via API, with the same authentication you do) to Take Over the dataset (https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/takeoveringroup) after that, you should be able to execute Update parameters. Also, if you then get into the Portal UI (with the original credentials you use now) and go to the Schedule Refresh page of the dataset, you will see who the owner is now (once you are not the owner, a line appears there saying “the dataset has been configured by …….. Would you like to take over the setting?”

 

Also, in the future when you post a request/response, please paste the entire raw data (you can remove the authentication token…) so we can see the request Id etc. and if necessary, investigate in our internal logging.

Regular Visitor
Posts: 16
Registered: ‎02-29-2016

Re: Updating parameters through the service API

As obvious as it should have been you were indeed right. I was publishing reports to a workspace owned by another account. The other account can not act on them through the API until ownership is transfered