Forum Discussion
TP-101
Helper I
2 years agoM Query Post REST API, return format not JSON with Expression.Error
I'm attempting a POST to a REST API which should return data in JSON. The POST appears to succeed however, receiving an Expression.Error trying to convert the response to binary. Can this query be ...
TP-101
Helper I
2 years agoThank you lbendlin . I changed line 31 to include a content-type however, still seeing the Expression.Error. I'm not sure what is tring to convert to binary since the response should be json. Any idea?
GetJsonQuery = Json.Document(Web.Contents("https://" & #"Tenant" & #"GetMetric", [Headers=[Authorization=AccessTokenHeader, #"Content-Type"="application/json"], Content=Text.FromBinary(Json.FromValue(data))]))lbendlin
Super User
2 years agoTry adding an accept directive.
- TP-1012 years ago
Helper I
Added the accept and still observing the same Expression.Error.
GetJsonQuery = Json.Document(Web.Contents("https://" & #"Tenant" & #"GetMetric", [Headers=[Authorization=AccessTokenHeader, #"accept"="application/json"], Content=Text.FromBinary(Json.FromValue(data))]))- lbendlin2 years ago
Super User
Try this.
GetJsonQuery = Json.Document(Web.Contents("https://" & Tenant & GetMetric, [Headers=[Authorization=AccessTokenHeader, Accept="application/json"], Content=Text.FromBinary(Json.FromValue(data))]))You will also need to read up on RelativePath and Query.
- TP-1012 years ago
Helper I
Changing it to that shows a Bad Request (400) error instead.