Hi all,
I’m completly stuck.
I’m trying to make a post to an old API.
This API needs a POST, with a raw body in XML and custom headers such as api-key
I got this error and have no clue what to do .
Thanks for your help
Hi all,
I’m completly stuck.
I’m trying to make a post to an old API.
This API needs a POST, with a raw body in XML and custom headers such as api-key
Welcome to the community @Jerome_Laurens!
It looks like you want to do something like this:
(you can copy the following JSON and then paste directly into n8n)
Great @jan ! it works, the only difference with my previous tries was that the header field is an expression and not a value.
DO you know why that’s changing something ?
Another question : how do you export this json ?
That is changing something because the content-type which got also set, gets added to that header. If that header is a string and not an object (what it is, if you set it as an expression) it can not add that content-type and so it fails.
What do you mean with “this json”? The node? Simply select the nodes you want to export and then copy (ctrl + c). You are then able to paste it anywhere you want with ctrl + c.
Crystal clear Jan, thank you.
And yes, I just wanted to export/import the json like the one you sent me.
Thanks again
Perfect. You are welcome, have fun!
and the “ xxxx” can use : {{$node[“Webhook”].json[“query”][“name”]}}?
if I use this :
{{ {“api-key”: “{{$node[“Webhook”].json[“query”][“name”]}}”} }}
I get an error.
What is the error? At a guess the extra {{ }} are not needed try the below.
{{ {“api-key”: “$node[“Webhook”].json[“query”][“name”]”} }}
ERROR: Expression is not valid: Invalid or unexpected token [Error in parameter: “headerParametersJson”]
[invalid (Expression is not valid: Invalid or unexpected token)]
I must have missed something, what was the original error when you tried using it?
[invalid (Expression is not valid: Invalid or unexpected token)]
So same error with both options, does the expression editor show the right output?
@aston_he, can you send a screenshot of what the expression editor shows?