Forum Discussion

Partha_Kar's avatar
Partha_Kar
New Member
3 years ago

Getting 401-Unauthorized response while trying to Refresh Power BI Dataset using Postman API call!

Hello Experts,

 

I need an urgent help on one of the issues I am facing while trying to refresh the Power BI Dataset using POSTMAN.

Issue description -

1. Getting the Bearer Token -
This part is successful using the client id, tenant id, group id, dataset id and client secret I have been provided by the Admin team.
To generate the token I have used this URL : POST https://login.microsoftonline.com/{tenentId}/oauth2/token
Headers: Content-Type: application/x-www-form-urlencoded
Body:
client_id={clientId}
&client_secret={clientSecret}
&scope=https://analysis.windows.net/powerbi/api/.default
&grant_type=client_credentials

-> I am getting the token with no issues.

 

2. Refreshing the Dataset -
This part is giving me headaches!
Method: POST
url: https://api.powerbi.com/v1.0/myorg/datasets/{dataset-id}/refreshes
Headers Authorization: Bearer {token}
Body:
{
"type": "full",
"commitMode": "transactional",
"objects": [
{
"table": "TEST PO and Requisition"
}
],
"applyRefreshPolicy": "true"
}

But after applying all these, I am only getting - 401 Unauthorized!

Please help me in this or guide me if there is any workaround for achieving this refresh from a third party client.

 

Thanks in advance!

Regards,
PK

3 Replies

  • has your service principal access to the pbi workspace?

    • Partha_Kar's avatar
      Partha_Kar
      New Member

      Hello R1k91 , 
      Sorry for the late response.

      I am quite new to Power BI.. so, it would be really helpful if you could share with me How & Where to check whether - the Service Princiapl has access to access OCI object Storage?

       

      Regards,

      Partha

    1. open app.powerbi.com
    2. navigate to the workspace containing the dataset to refresh
    3. press "access"
    4. check if service princal has access