Ricky
Ricky5d ago

Ricky - Hi, Have a good weekend!I wish all mem...

Hi, Have a good weekend! I wish all members success in their business. I would like to ask for help with a problem I encountered in my development project. If the path setting of Rest API is set to api/get/:id, I would like to ask for help if anyone knows how to fetch and retrieve data corresponding to id. The database is postgresql. Thanks.
5 Replies
Gaurav Chadha
Gaurav Chadha4d ago
Hi @Ricky, For the path variable (parametrized request) - you can indeed include a path variable in the REST API trigger on Buildship, you can define a dynamic part of the path using a named parameter (often called a wildcard or path variable). Here's how you can set this up: In the REST API trigger configuration, you specify the Path and Method. For dynamic paths, you can use a named parameter by prefixing it with a colon. For instance: Path: /api/call/:id if a request is made to a URL like - https://6dk2jv.buildship.run/api/call/:123 , the workflow associated with this path will be triggered. The variable part, 123, is captured by :id. You can access/retrieve this variable within your workflow using the request.path object. To extract the conversationId from the path, you could use the following expression within your workflow's expression editor: request.path.split('/')[3] This will retrieve the conversation ID from the path, which in your example would yield 123. Sample Remix you can use - https://buildship.app/remix/c060337f-549c-4ec6-b992-68fd8d38f854
BuildShip - Visual backend workflow builder
Visually build workflows and powerful backend logic for your apps. Powered by AI, connect to anything with or without code.
Ricky
Ricky4d ago
thanks. but i couldn't do it, as this way in fetching data node, there is not 'request.path'
Ricky
Ricky4d ago
No description
Gaurav Chadha
Gaurav Chadha4d ago
This won't work in test You need ship your workflow and make request to the endpoint with path variable
Ricky
Ricky4d ago
thanks. thanks. this platform is very simple and convenient