Forum Discussion
LarryBroward
Helper I
3 years agoPut API with Body
Hi, I need to pass the following in the body, <?xml version="1.0" encoding="utf-8" standalone="yes"?> <ns2:invocationContext xmlns:ns2="http://collectionspace.org/services/common/invocable"> <...
- 3 years ago
Hi LarryBroward ,
I'm not used to work with xml files.
Have you triedXml.Document(Web.Contents(url, [Headers=headers, Content = postData ] ) )or
Excel.Workbook(Web.Contents(url, [Headers=headers, Content = postData ] ) )instead?
ImkeF
Community Champion
3 years agoHi LarryBroward ,
for each quote in your text, you have to escape it with another quote. Other special characters don't matter here.
This is the general setup:
let
url = ...,
headers = [#"Content-Type" = "application/xml"],
postData = Text.ToBinary(
"<?xml version=""1.0"" encoding=""utf-8"" standalone=""yes""?>
<ns2:invocationContext xmlns:ns2=""http://collectionspace.org/services/common/invocable"">
<mode>nocontext</mode>
</ns2:invocationContext> "
),
response = Web.Contents(
url,
[
Headers = headers,
Content = postData
]
),
xmlResponse = Xml.Document(response)
in
xmlResponse
LarryBroward
Helper I
3 years agoThats work as far as the syntax goes I was trying to_date('"&Date.ToText(sDate)&"' , 'mm/dd/yyyy') the '"& &"' that I use for my date paramaters. However i am getting this error "Web.Contents with the Content option is only supported when connecting anonymously" . I am using the same setup with a raw body in Postman with Basic Authenticationand it work fine. I am not sure how to get around this in Power BI if that is the actual error.
Thanks