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...
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
resultBessonnizza
6 years agoHelper II
Get another error:
Expression.Error: We cannot convert the value "{Period:{Begin:"1584..." to type Binary.
Details:
Value={Period:{Begin:"1584428676205",End:"1584515076205"},TargetObject:{ObjectId:"51005",ObjectTypeId:"0F1E3A4A-88F5-4166-9BE8-76033DD85D08"}}
Type=[Type]
Can you explain me, this expressions is equal to each other or not:
data = Json.FromValue([Begin=1584428676205, End=1584515076205, ObjectTypeId="0F1E3A4A-88F5-4166-9BE8-76033DD85D08", ObjectId=51005]) equal
data = "{Period:{Begin:""1584428676205"",End:""1584515076205""},TargetObject:{ObjectId:""51005"",ObjectTypeId:""0F1E3A4A-88F5-4166-9BE8-76033DD85D08""}}"