PUT request in HTTP module not working when referencing previous nodes

Hi, I have just downloaded the desktop version of N8N Today :blush:

I’m trying to send a PUT request via the Woocommerce Subscriptions API.

It works if I hardcode the values in instead of referencing the nodes, if I reference the nodes, this is the error that is returned:

‘ERROR: The resource you are requesting could not be found – HTTP Code: 404’

This is my first time using N8N (Currently desktop version), I am replicating one of my working scenarios over from Integromat. The purpose of this is to remove (make quantity: 0) for all line_items that pass through the IF module.

I understand that I may not have figured out how to structure the flow properly yet on N8N, all help is appreciated!


I believe I have identified the issue, but I’m not sure how to resolve it. The last HTTP node in my workflow uses a variable named “id”, which is sourced from the third node, in its URL field. This “id” variable is used to access a specific subscription from the endpoint.

The last HTTP node appears to work as expected the first time/run, but then I receive an error. If I manually enter the subscription id into the last HTTP node’s URL field, instead of referencing it from a previous node, the workflow runs without any issues. I suspect that this is happening because the workflow loops through all the line items, but since there is only one subscription id, it only works once (even if there are 30 line_items to run through). When it reaches the second line item, there are no more subscription ids to reference.

Is there a way to set variables as constants that don’t get looped? I have tried using the “set” node before the format node (I don’t even know if the set node is the way to go), but this seems to cause problems with my code node. Any assistance would be greatly appreciated.

Hey @mastema,

Welcome to the community :raised_hands:

This is one of those things when it comes to the looping that catches people out, If you know the specific index like say it is the first item you want to use you could use {{ $("<node-name>").first().json.item }}.

We have a handy page here which lists a few of the options you can run with: Built in methods and variables reference - n8n Documentation

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