Use option in request url (Custom node)

I’m building a custom node and would like to use a parameter the user can set as an option in the url. Consider the following (shortened) example:

		properties: [
			{
				displayName: 'Operation',
				name: 'operation',
				type: 'options',
				noDataExpression: true,
				required: true,
				displayOptions: {
					show: {
						resource: ['task'],
					},
				},
				options: [
					{
						name: 'Get',
						value: 'get',
						description: 'Get a task',
						action: 'Get a task',
						routing: {
							request: {
								method: 'GET',
								url: '=/tasks/{{$taskId}}',
							},
						},
					},
				],
				default: 'get',
			},
			{
				displayName: 'Task ID',
				name: 'taskId',
				type: 'string',
				default: '',
				required: true,
				displayOptions: {
					show: {
						resource: ['task'],
						operation: ['get'],
					},
				},
			},
		]

When I add that node in n8n, I can modify it and enter a Task ID but the request made does not contain the value I entered in the field.

How can I do this?

Welcome to the community @kolaente!

=/tasks/{{$parameter.taskId}} should work.

1 Like

That seems to work, thanks!

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