Forum Discussion

shuhn1229's avatar
shuhn1229
Resolver I
3 years ago
Solved

Refreshing a Model with REST API POST Calls

Hi all,

 

I have a PowerBI model that interacts with a REST API datasource. This particular datasource only reports using POST calls. I used the workaround described here: https://community.powerbi.com/t5/Desktop/Power-BI-Desktop-and-REST-API-POST-METHOD/m-p/196892 . My POST datacall has an authorization header FWIW.

 

This all works fine and I can refresh all the data manually in desktop. However when I schedule a refresh and try to enter credentials for the POST source it errors out (anonymous doesnt work, neither does basic with my username and PW).

 

1) any luck on getting this to work?

2) is there a way where the POST source can be left out of the scheduled refresh?

 

Thanks!

Steve

 

  • 1. mind mentioning the error message?

    2. you can always choose to use a gateway and  to skip the connection test on the gateway, although that is not recommended.

5 Replies

  • 1. mind mentioning the error message?

    2. you can always choose to use a gateway and  to skip the connection test on the gateway, although that is not recommended.

    • shuhn1229's avatar
      shuhn1229
      Resolver I

      Hi lbendlin thank you for responding.

       

      Two important notes:

      • 1) the site can only be accessed internally... e.g. mycompany.database.com, which can only be accessed by UN and PW (see note on the auth header)
      • 2) errors out is the wrong verbiage. the refresh essentially times out (freezes etc) when using the web client to refresh in any mode (anonymous, basic etc). I've tried skipping the connection.
  • Hi , shuhn1229 

    As far as I understand, the API corresponding to the connection is normally accessed using anonymous mode. There should be a token string in the request header of your API, the general token is generated by another API, you can try to create the API that generated this token as a function in Power Query, and then generate a token to pass into your parameters. Then both use anonymous credentials to log in. If your API can only be accessed on your intranet, you may also need to download the on-premise data gateway on your computer to configure the corresponding credentials.

    For more information, you can refer to :
    Power BI Gateway | Microsoft Power BI

    On-premises data gateway - Power BI | Microsoft Learn

     

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

    • shuhn1229's avatar
      shuhn1229
      Resolver I

      Hi v-yueyunzh-msft 

       

      The datasource can only be accessed locally (e.g. mycompany.database.com) and as noted above, login requires a UN/PW that is provided by the AUTH header in my code. I'll look into the data gateway.

       

      Steve

  • I figured this out. The key is getting a gateway setup as users pointer out.