From Excel VBA, I am POSTing to an API that takes XML as one of the parameters.
It works fine unless there are ampersands(&) in the XML.
I have escaped them to &
but I still get an error back from the API telling me there are disallowed characters.
I am using the header as follow:
setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
The XML I am posting looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xml>
<row>
<column id="747">ALROS TRAVEL & HOLIDAY CO.</column>
<column id="748">73318</column>
<column id="749"/>
<column id="750"/>
</row>
</xml>
It appears that & is causing the issue based on my testing.
I have tested the XML through their testing tool and it works fine so I think the request headers are the problem.
I have asked the API developers to check what they receive from my POST and it appears to get cut off as soon as an & appears (even if it's escaped).
The only conclusions I could draw were that I'm using the wrong request headers, or that I should be posting the XML in a different way.
Their test tool is an HTML form which uses "multipart/form-data" but I can't seem to use that from VBA or I get "No authentication information is detected" message back.
Does anyone know what I could be doing wrong?
Thanks