Forum Discussion
Try to convert curl into powerquery
- 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
jsonResponselet
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
Find the payload
let
url = "https://mywebsite:3129/v1/blocklist",
headers = [#"X-APIKey" ="my key",
#"Content-Type"="application/json"],
body = "{""}",
response = Web.Contents(
url,
[ Headers = headers,
Content = Text.ToBinary((body))
]
),
jsonResponse = Json.Document(response),
response1 = jsonResponse[response],
blocklists = response1[blocklists],
blocklists1 = blocklists{0},
#"Converted to Table" = Record.ToTable(blocklists1)
in
#"Converted to Table"