Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Request to run a task in a rest API

Tags:

rest

I want to build a RESTFUL API.

I have a resource with task plans.

The client should request the server to run task such as benchmarking on one of the task plan metrics.

which request should be used. POST or GET?

and what should be the uri?

/api/plans/<id>/run or /api/plans/run/<id> ?
like image 311
Akhil Batra Avatar asked Nov 21 '25 07:11

Akhil Batra


1 Answers

I will go for a POST and since is an action on a specific plan, the url should be plans/id?action=run.

run is not a sub collection of a plan so query param must be used in this case


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!