Forum Discussion
Anonymous
3 years agoNot applicable
POST query with authorization token
Hi, I'm trying to post info into a DB using an endpoint, but It's not working, this is the query: let
data = Json.FromValue([ fieldName="someData"]),
Source = Json.Docum...
Anonymous
3 years agoNot applicable
Thanks Anonymous - I think you need to change this step:
data = Text.FromBinary( Json.FromValue( [fieldName="someData"] ) )Anonymous
3 years agoNot applicable
I tried without Text.FromBinary, just Json.FromValue and the error remains
- Anonymous3 years agoNot applicable
Sorry - I sure how to help. Can you double check that Json is properly formatted by using VS Code or Postman. Obtain the Json from the Text.FromBinary step and past it into another tool to see if the error is occurring.
- Anonymous3 years agoNot applicable
This is the code using JsonPlaceHolder API:
let data = Json.FromValue([title = "ID_WERTPAPIER", body = "851399", userId = "US" ]), outputdata = Text.FromBinary(data), Source = Json.Document(Web.Contents("https://jsonplaceholder.typicode.com/posts", [Headers=[#"Content-Type"="application/json"], Content=data])) in SourceAnd it works!!! But if I use my own API, adding authorization to the header, something goes wrong, now the error message is this:
Expression.Error: We cannot convert a value of type Binary to type Text.
Details:
Value=[Binary]
Type=[Type]I know that my endpoint is working cause it works in postman.