Forum Discussion

CatParky's avatar
CatParky
Frequent Visitor
6 years ago
Solved

Help : Create POST api request using double quotes in body to format payload

Hi, I'm trying to write a query that will format and POST an excel table contents to a Knack database using their api. So far I have the following query using the custom GetJson function from Chr...
  • artemus's avatar
    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.