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 ,
what will be returned if you use this syntax?:
let
//apiKey = "your_api_key_here", -- Api Doesn't require a key
username = PARAM_API_USERNAME,
password = PARAM_API_USER_PASSWORD,
auth = "Basic " & Binary.ToText(Text.ToBinary(username & ":" & password), BinaryEncoding.Base64),
apiUrl = PARAM_API_BASE_URL,
postData = Text.ToBinary(
//Excel is the default and returns without an OutputMime using postman
"<?xml version=""1.0"" encoding=""utf-8"" standalone=""yes""?>
<ns2:invocationContext xmlns:ns2=""http://collectionspace.org/services/common/invocable"">
<mode>nocontext</mode>
<outputMIME>application/xml</outputMIME>
</ns2:invocationContext> "
),
url = apiUrl , headers = [ #"Authorization" = auth,#"Content-Type" = "application/xml"],
source = Xml.Tables(Web.Contents(url, [Headers=headers, Content = postData ] ) )
in
source - LarryBroward3 years ago
Helper I
The source is returned in a single line of XML.
It puts the report in a single column called "page.text.textContent.Element:Text" when expanded down. Then I have to pivot every 16 lines for the 16 different columns, which is a workaround but their is a bit more work on my end for setup and I can't be sure it will work in every situation. It would be nice if I can get the whole excel returned that works from the UI and Postman.
Thanks,