How to manually run a task via a URL

How can I manually run a task from a link

What is the exact use case?

@dkayiwa need to add a link to the homepage to run a task

It looks like we need a TaskActionResource just like we have this for modules https://github.com/openmrs/openmrs-module-webservices.rest/blob/master/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ModuleActionResource1_8.java

@dkayiwa and this would execute a task when called right?

Yes that is correct.

@dkayiwa and @ssmusoke , we seem to already have that feature here

@dkayiwa , the Feature already exists , and it can perfom commons tasks like shedule , reshedule ,delete, stop a task etc, am just going to add a functionality to manually run an aleady sheduled task , without interfering with the shedule

How far with this implementation and how can in call a particular task to be executed

@solemabrothers i did that work and it was merged some time ago

,for how to use the feature , you can POST this endpoint /ws/rest/v1/taskaction

with this request body

{ "action": "runtask", "tasks": ["TaskDefinition_name "] }

Or look at the Unit test in the above PR

1 Like