Forum Discussion
rtaylor
6 years agoHelper III
Working Examples of WebAction.Request
Hello, I'm looking for any working examples of using WebAction.Request? Also, does anyone know the syntax of an action type? Thank you
lbendlin
6 years agoSuper User
I get the same error as in the thread I linked to. For now I am ok with just using Web.Contents even if it is sometimes a bit weird. Here is an example of a call against Microsoft's own REST API that requires some creative result wrangling because they don't adhere to simple HTTP standards.
(GatewayId as text, ConnectionId as text) =>
let
JsonData = try Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/gateways/" & GatewayId & "/datasources/" & ConnectionId & "/status", [Headers=[Authorization=Authorization]])),
value = if JsonData[Error][Message]="We reached the end of the buffer." then "True" else "False"
in
value
A "gateway connection is good" 200 response is hampered by an empty return body that I have to mitigate separately. Maybe you can do something similar with your web request.
rtaylor
6 years agoHelper III
Yeah its not that I can't use web.contents. Its that the nature of web.contents hides the response headers from Value.Metadata. I'm hoping/praying WebAction.Request won't have the same restrictions.