Forum Discussion

venkat_bi's avatar
venkat_bi
New Member
8 years ago

powerbi dataset and dashboard refresh api - acquire access token using client http connection

Hi,

 

I am trying to use power bi api to refresh data set and dash boards after my daily extract & load tool loads the data into the on-premise tables.

 

I have gone through lot of posts and community articles and followed various steps to retreive access token and try to make a refresh call to dataset and dashboard. Its not working I always get 404 error. 

 

The approach I followed was to extract the access_token using C# sample code ( got it from the power bi developer site) and used the token in "Authorization"  & added content-type as application/json as headers and tried to GET the below url

https://api.powerbi.com/v1.0/myorg/groups/me/datasets/d49f21e2-aef1-4cc8-a512-b8523d1e6c63/refreshes

 

I would like to know if I want to get the access_token through http clients ( like postman or curl ) and invoke refresh api's is there a direct approach supported by Power BI API or do I need to follow any special steps to achieve this?

 

Thanks,

Venkat

 

3 Replies

  • Eric_Zhang's avatar
    Eric_Zhang
    Microsoft Employee

    venkat_bi wrote:

    Hi,

     

    I am trying to use power bi api to refresh data set and dash boards after my daily extract & load tool loads the data into the on-premise tables.

     

    I have gone through lot of posts and community articles and followed various steps to retreive access token and try to make a refresh call to dataset and dashboard. Its not working I always get 404 error. 

     

    The approach I followed was to extract the access_token using C# sample code ( got it from the power bi developer site) and used the token in "Authorization"  & added content-type as application/json as headers and tried to GET the below url

    https://api.powerbi.com/v1.0/myorg/groups/me/datasets/d49f21e2-aef1-4cc8-a512-b8523d1e6c63/refreshes

     

    I would like to know if I want to get the access_token through http clients ( like postman or curl ) and invoke refresh api's is there a direct approach supported by Power BI API or do I need to follow any special steps to achieve this?

     

    Thanks,

    Venkat

     


    venkat_bi

    You can get the access token following the my reply in this thread. Note that the refresh API shares the 8(48 for premium license) times per day limitation with the "schedule refresh" configuration on Power BI Service.

    • venkat_bi's avatar
      venkat_bi
      New Member

      Hi Eric,

       

      Thanks for your response. Yes, I followed the steps mentioned but I get an error "invalid_grant". See the response message below also see the attached request screenshot for your reference.

       

      {
          "error": "invalid_grant",
          "error_description": "AADSTS70002: Error validating credentials. AADSTS50126: Invalid username or password\r\nTrace ID: d4467237-2cab-4141-ae4a-5259aa0a5300\r\nCorrelation ID: 2cbf0359-9be3-4b01-a072-6d8370aadeeb\r\nTimestamp: 2017-11-26 23:13:55Z",
          "error_codes": [
              70002,
              50126
          ],
          "timestamp": "2017-11-26 23:13:55Z",
          "trace_id": "d4467237-2cab-4141-ae4a-5259aa0a5300",
          "correlation_id": "2cbf0359-9be3-4b01-a072-6d8370aadeeb"
      }

       

      Thanks,

      Venkatesh S

      • Eric_Zhang's avatar
        Eric_Zhang
        Microsoft Employee

        venkat_bi

        The error indicates the account&password is not correct. What is that account, could you double check it?