Forum Discussion

syl's avatar
syl
Regular Visitor
8 years ago
Solved

REST Api 401 only on Datasets.GetTable and Datasets.GetParameters operations

 

Hi,

I try to play with embedded reports and it works well but I could not find why I'm not able to get or set the dataset parameters.

The groupId, datasetId and reportId are working for those operations (with the same bearer token)

 

Reports.GetReportsInGroupAsync(GroupId)
Datasets.GetDatasetByIdInGroupAsync(GroupId, DatasetId)

here is my raw http request

 

GET https://api.powerbi.com/v1.0/myorg/groups/{GroupId}/datasets/{DatasetId}/parameters HTTP/1.1
Authorization: Bearer eyJ0eX........QlTnGAw_5lkPQ
User-Agent: Microsoft.PowerBI.Api.V2.PowerBIClient/2.0.12.18114
Host: api.powerbi.com

the raw http response

 

HTTP/1.1 401 Unauthorized
Cache-Control: no-store, must-revalidate, no-cache
Transfer-Encoding: chunked
Content-Type: application/octet-stream
Server: Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Frame-Options: deny
X-Content-Type-Options: nosniff
RequestId: {requestid}
Date: Tue, 08 May 2018 13:07:48 GMT

0

 

the code that triggers it

 

Datasets.GetParametersInGroupAsync(GroupId, DatasetId);

I tried everything I can figure out:

- with permissions (app permission for powerbi service and AAD and my user is admin of the powerbi workspace)

- dataset configuration (my parameter is used by the query etc ...)

 

Any idea ? thanks !!

 

UPDATE:

 

After the first response in the post I tried to do the flow with Postman and realize the client_id was from another app with only read permissions, so using proper sets of permissions fixed it.

 

The scope property of get token helps me to verify the list

 

 

Thanks.

1 Reply

  • v-micsh-msft's avatar
    v-micsh-msft
    Microsoft Employee

     

     

    Could you get the DataSets through PostMan?

     

    For example:

     

    You may follow the steps menitoned in the folloiwng thread:

    https://community.powerbi.com/t5/Developer/How-To-Get-embed-token-using-Get-Post-only/td-p/294475

    Adding the documents for reference:

    Get Tables

    Get Parameter

     

    If the account used has the proper permission to modify the Dataset, then it should be possible for it to load the Parameters through API.

     

    What kind of the DataSet that you are working with?

    By the way, is the user the owner of the Dataset? If not, take a try to take over the ownership under DataSet Settings, then check it again.

    Settings->DataSets

     

    Regards,

    Michael