-
Goal: Trying to hit an API endpoint that takes an XML POST body
-
Steps: I've set up the resource and query as described in the documentation, using a RAW body type, and a 'text/xml' Content-Type. I am using an XML query that I have verified works via curl at the command line, but for some reason it seems to be getting mangled by ReTool, and I'm getting an "invalid XML" response from the remote server.
-
Details: In the raw payload text input for the query, I'm putting the following XML:
<?xml version='1.0' encoding='UTF-8'?><DIRECTLINK_REQUEST><DIRECTLINK AccountNumber='REDACTED' ActionType='product_list'></DIRECTLINK></DIRECTLINK_REQUEST>
I've tried single-quoting it, double-quoting it, escaping all the special characters, putting it in a JS variable and doing {{ }} substitution, wrapping the XML in a {{ }} block and putting quotes around it...nothing seems to work.
Here's what ReTool says in the API Request tab under the 'request' key:
"request": {
"url": "REDACTED",
"method": "POST",
"body": "<?xml version='1.0' encoding='UTF-8'?><DIRECTLINK_REQUEST><DIRECTLINK AccountNumber='REDACTED' ActionType='product_list'></DIRECTLINK></DIRECTLINK_REQUEST>",
"headers": {
"User-Agent": "Retool/2.0 (+https://docs.tryretool.com/docs/apis)",
"Content-Type": "text/xml",
"Authorization": "REDACTED",
"ot-baggage-requestId": "undefined",
"x-datadog-trace-id": "REDACTED",
"x-datadog-parent-id": "REDACTED",
"x-datadog-sampling-priority": "0",
"x-datadog-tags": "REDACTED",
"tracestate": "REDACTED",
"X-Retool-Forwarded-For": "REDACTED"
}
}
The authentication is definitely working (I've broken it intentionally to see), and the error response is coming from the remote, so I know the problem isn't a connection issue.
What am I missing here? It seems like the POST body is being mangled, but I can't tell what's going on.