Forum Discussion

gbros's avatar
gbros
New Member
1 year ago
Solved

Power BI - Need data from a POST Api

I am trying to get data forma an API with <post method from Power query but I cannot do it, and I don't find the error...here is my code:   There is some parts commented because I think the p...
  • ZhangKun's avatar
    1 year ago

    Yes. You should try running the following two examples (check the "json" fields in the result to see if your program is correct). I believe you will truly understand how to post data.

     

    let
        resp = Web.Contents(
            "https://httpbin.org", 
            [
                RelativePath = "post", 
                Content = Json.FromValue([A = 1, B = "2025/01/02"])
            ]
        ), 
        data = Json.Document(resp)
    in
        data

     

    let
        resp = Web.Contents(
            "https://httpbin.org", 
            [
                RelativePath = "post", 
                Content = Text.ToBinary("{""A"": 1, ""B"": ""2025/01/02""}", TextEncoding.Utf8)
            ]
        ), 
        data = Json.Document(resp)
    in
        data