Upload media to wordpress not working with expression

When I use a fixed URL for uploading pictures to WordPress, it works fine. But I need a solution, where i can upload to an URL, that is filled out via expression. See:

What is the error message (if any)?

Hi @ManyQuestions, which expression are you actually using in your HTTP Request node? Does the number of items change between the nodes in your workflow? If so, your expression might need to account for that, for example by using one of the available expressions using .first().

Which version of n8n are you using and how does your workflow look like?

1 Like

Hi @MutedJam , thanks for the answer. I am using this expression:

The expression is taking data from this field of a set node:

Yes, the number of the items changes once in the execution from 1 to 5 and it always changes from execution to execution (from 1 to X-items).

Yes, the number of the items changes once in the execution from 1 to 5 and it always changes from execution to execution (from 1 to X-items).

So assuming HTTP Request node in your workflow only ever returns a single n8n item (it can still have multiple objects in its json.data array, only the number of n8n items matters), you could try an expression of {{ $("HTTP Request").first().json.data[8].website }}

This would mean n8n always tries to read the first (and only) item of the HTTP Request node, even when processing the second, third, etc. item on your current node.

2 Likes

Thanks, @MutedJam. It’s looks like it’s working now.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.