XML body in http request

Describe the issue/error/question

Invalid XML Request

What is the error message (if any)?

I have to use Acoustic’s XML api in order to acquire some data. But I can’t manage to put the xml in the body parameter. Does anyone has an idea on how to do this?
XML example:

Please share the workflow

This is the xml in the body:

<Envelope>
	<Body>
		<GetScoringModels></GetScoringModels>
	</Body>
</Envelope>

My node, with hidden bearer token:

Output

<Envelope><Body><RESULT><SUCCESS>false</SUCCESS></RESULT><Fault><Request/><FaultCode/><FaultString>Invalid XML Request</FaultString><detail><error><errorid>51</errorid><module/><class>SP.API</class><method/></error></detail></Fault></Body></Envelope>

Hi @loren, welcome to the community!

Have you tried enabling the JSON/RAW Parameters option of your HTTP Request node?
image

This will allow you to provide the entire request body instead of just key-value pairs. You can also configure the authentication header as credentials in n8n, this way they wouldn’t be part of your workflow if you share it with someone.

Hi @MutedJam,

Thanks for your feedback!

  • I’ve tried using the json/raw parameters, but then I don’t see how I can pass the Authorization: Bearer {{Bearertoken}} in the Headers?
  • Can I also configure the authentication header based on query parameters only? In a previous node, I do a post to the token endpoint with all the credentials in the query. So I don’t select a “way to authenticate” in my node.

Grts,
Loren

Hey Loren, have you checked out the Authentication options in the HTTP Request node?

The Header Auth option would let you configure an Auth header (which you can re-use in your other HTTP Request nodes too):

Screenshot from 2022-03-25 17-32-20

1 Like

Hi @MutedJam,

If I select Header Auth I can only put 1 name and 1 value, while I have to give in the client_id, client_secret,… Do you have an example?

In this case I would probably only pack the client_secret vie the Header Auth and set the client_id via the Headers parameter on the node.