Forum Discussion

dawidvh's avatar
dawidvh
Helper I
8 years ago
Solved

Power BI Service - Refresh of data on API using POST method

 Hi everyone.   We have data that is accessed through a web API using a POST method with a api-key in the header in order to authenticate. This works well from the Power BI desktop, but as soon as ...
  • v-frfei-msft's avatar
    8 years ago

    Hi dawidvh,

     

    Based on my research, specify root URL in the url part, and place the remaining URL part into RelativePath parameter, So you can update your code as below. As long as you can use anonymous authentication to access root url of your api, you are able to use anonymous authentication to refresh dataset in Power BI Service.

     

     

    let
    authKey = “****”,
    url =”root url of your api”,
    body = “{}”,
    Source = Json.Document (Web.Contents(url,[
          Headers = [#”api-key” = authKey,
                               *********
                             #”Content-Type” = “ “application/json”],
          Content = Text . ToBinary(body),
          RelativePath="/api/….."
                        ]
           ) ),
    Data = Source[data],

     

    For more details, please check this blog.

     

    Regards,

    Frank