Forum Discussion
Help : Create POST api request using double quotes in body to format payload
- 6 years ago
I think the issue is that you are double formatting the data.
Remove:
body = GetJson(#"Promoted Headers"),change
Content = Text.ToBinary(body)to
Content = Json.From(#"Promoted Headers")And hopefully that should work.
Actually, looking into this further. You need to use a single row in a table, not the entire table... E.g.
change
Content = Json.From(#"Promoted Headers")to
Content = Json.From(#"Promoted Headers"{0})if you just want to use the first row of the table.
I think the issue is that you are double formatting the data.
Remove:
body = GetJson(#"Promoted Headers"),
change
Content = Text.ToBinary(body)
to
Content = Json.From(#"Promoted Headers")
And hopefully that should work.
Actually, looking into this further. You need to use a single row in a table, not the entire table... E.g.
change
Content = Json.From(#"Promoted Headers") to
Content = Json.From(#"Promoted Headers"{0})
if you just want to use the first row of the table.
- CatParky6 years agoFrequent Visitor
Thank you so much for your help. Using your suggestion I get the error :
Expression.Error: The name 'Json.From' wasn't recognized. Make sure it's spelled correctly.
I tried
Content = Json.FromValue(#"Promoted Headers"{0})And got the same view of the fields with no values.
- CatParky6 years agoFrequent Visitor
My error !
I skip read the part about removing
body = GetJson(#"Promoted Headers"),I also updated to Jason.FromValue and it's worked @:
Source = Json.Document(Web.Contents(url,[ Headers = [#"X-Knack-Application-Id"=AppID, #"X-Knack-REST-API-Key"=AuthKey, #"Content-Type"="application/json"], Content = Json.FromValue(#"Promoted Headers"{0}) ] )) in Source