Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

REST API call from Power Automate

Hi

 

I am trying to run the following API calls in Power Automate to get the history, and refresh the datasets:

GET https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshes

POST https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshes

 

I can run a single call of POST, I get a status code of 202,  but if I try to run the same call in a loop I get a 401. The call is exactly the same other than there is a loop and the API is called multiple times.

 

You have to first get a token for the authorization, I have tried both a single call before the loop and within the loop, still the same error.

 

Any ideas please?

 

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Grrrr, I am so annoyed, but also very happy.

     

    I have found my error. Its not because of the loop, that was a red herring! What it was and the reason why it's so annoying is, as part of the http REST API call is your header. This has your autorization, to the left you have Bearer and your access_token which you have picked up already. The trick is

     

    MAKE SURE YOU HAVE A SPACE AFTER 'Bearer'

3 Replies