The Problem
Currently, creating RESTful APIs with n8n is cumbersome because the webhook node does not support optional paths or dynamic route configurations. For example, if you want an endpoint like /user/:id/file/:id
, you need to create individual webhook nodes for every possible variation of that path, such as:
/user
/user/:id
/user/:id/file
/user/:id/file/:id
Additionally, you must multiply this by the number of HTTP methods (GET, POST, PUT, DELETE, PATCH, etc.), which can result in 30+ webhook nodes just for basic functionality.
This approach makes workflows unnecessarily complex and harder to maintain.
The Use Case
I’m building the backend of an MVP using n8n and Supabase, and we plan to stick with n8n for processing all data, even as we scale. To make this feasible, I need a way to define REST API endpoints with greater flexibility and fewer nodes, following REST API best practices.
For example, I should be able to configure a single webhook node that handles:
/user/:id
(optionalid
)/user/:id/file
/user/:id/file/:fileId
This would drastically reduce the complexity of workflows and align n8n with modern API design standards.
Why This Is Beneficial
- Simplifies Workflows: Reduces the number of webhook nodes required, making workflows easier to create and maintain.
- Improves Scalability: Allows developers to build more complex APIs without creating an unmanageable number of nodes.
- Aligns with Standards: Supports REST API best practices, improving interoperability and readability for developers.
Supporting Resources
- Optional Endpoint path in webhooks - is it possible?
- Best Practices for REST API Design – Stack Overflow Blog
- RESTful API Design Best Practices Guide 2024
Willing to Contribute
Yes
If you like this idea, don’t forget to upvote! The more votes this feature gets, the higher its priority will be.