Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Examples of WebMethod.Post(...)

Hi all, I'm interested in updating data sources via a REST API based on information generated from a report, but I'm struggling to understand how to use the WebMethod.Post(...) function. There's n...
  • Eric_Zhang's avatar
    9 years ago

    Anonymous wrote:

    Hi all,

    I'm interested in updating data sources via a REST API based on information generated from a report, but I'm struggling to understand how to use the WebMethod.Post(...) function. There's no documentation that explains this API or provides an example on how it can be used. Can anyone provide some insight on how to make POST calls within Power BI?

    Thanks in advance!
    Martin


    Anonymous

    May I know why you'd like to send POST request in Power BI? Usually to get data, it is to call a GET request. Anyway, you can try

    below sample which calls the POST API of streaming dataset.

     

    let
         
        url = "https://api.powerbi.com/beta/72f988bf-86f1-41af-91ab-2d7cd011db47/datasets/29f1e104-5e56-4247-8712-8f109102109f/rows?key=cZs8uA30GFpBHTi8bCSEbt2RK6fZn3QuZDnp6pgsyk1JofKe49WjSXxbBiMlqb1NXjkCb5sSHeNS52GFIxbCnA%3D%3D",
        body = "
    [
    {
    ""VALUE"" :198.6
    }
    ]
    ",
        Source = Web.Contents(url,[Headers = [#"Content-Type"="application/json"], Content = Text.ToBinary(body)])
    in
        Source