Forum Discussion
Bessonnizza
6 years agoHelper II
Json.FromValue
Hello there, I want to write POST request with data for WEB service. I try to use Json.FromValue function to convert to JSON, but it isn't working. JSON data schema: My POST request...
Bessonnizza
6 years agoHelper II
try you example and get an error:
Expression.Error: We cannot convert a value of type Record to type Binary.
Details:
Value=[Record]
Type=[Type]
let
data = Json.Document("{Period:{Begin:""1584428676205"",End:""1584515076205""},TargetObject:{ObjectId:""51005"",ObjectTypeId:""0F1E3A4A-88F5-4166-9BE8-76033DD85D08""}}"),
headers = [#"accept"="*/*", #"ScoutAuthorization"=paramAuthorizationId, #"Content-Type"="application/json"],
web = Web.Contents("http://url", [ Content = data, Headers = headers, ManualStatusHandling = {404, 400}]),
result = Json.Document(web)
in
result
lbendlin
6 years agoSuper User
How about this?
let
data = "{Period:{Begin:""1584428676205"",End:""1584515076205""},TargetObject:{ObjectId:""51005"",ObjectTypeId:""0F1E3A4A-88F5-4166-9BE8-76033DD85D08""}}",
headers = [#"accept"="*/*", #"ScoutAuthorization"=paramAuthorizationId, #"Content-Type"="application/json"],
web = Web.Contents("http://url", [ Content = data, Headers = headers, ManualStatusHandling = {404, 400}]),
result = Json.Document(web)
in
result