Forum Discussion

SylvainN's avatar
SylvainN
Frequent Visitor
1 year ago
Solved

Try to convert curl into powerquery

the Curl where it work curl --location --request POST "https://MyWebSite:3129/v1/blocklist" ^ --header "X-APIKey: MyKey" ^ --Content-Type"="application/json   the answer is {"error":"Success","r...
  • SylvainN's avatar
    1 year ago

    Ok it good to know I need to specify a payload, but don't know how to apply, I read the website but do not find the info how to apply payload

    I try to appy this 

    let
    url = ...,
    headers = [#"Content-Type" = "application/json"],
    postData = Json.FromValue([x = 235.7, y = 41.53]),
    response = Web.Contents(
    url,
    [
    Headers = headers,
    Content = postData
    ]
    ),
    jsonResponse = Json.Document(response)
    in
    jsonResponse


    let
    url = "https://my website:3129/v1/blocklist",
    headers = [#"X-APIKey" ="my key",
    #"Content-Type"="application/json"],
    postData = Json.FromValue([""]),
    response = Web.Contents(
    url,
    [ Headers = headers
    Content = postData
    ]
    ),
    jsonResponse = Json.Document(response)
    in
    jsonResponse