How to change program workflow state using REST?


How do I change a patient program workflow state using REST?

For instance change state from DROPPED FROM TREATMENT to ACTIVE ON PROGRAM

For some reason, there is nothing about program workflows in the generated documentation :worried:

But it should be something like this: POST /ws/rest/v1/workflow/{parentUuid}/state/{uuid}

1 Like

But i want to change a state of a patient and there is no reference to patient on this URI /ws/rest/v1/workflow/{parentUuid}/state/{uuid}

This is probably not implemented yet (haven’t peeked at the code but I trust Lluis to read the docs).

I recommend that you create a JIRA ticket in the RESTWS project along for this feature. And I further recommend that you look at adding this to the REST web services module, (maybe propose a specific design), write the code, and send a pull request! That’s how this will get resolved most quickly.

Helio you’re right, it’s not program workflow resource the one you want. I think it’s ProgramEnrollmentResource (supported class PatientProgram) and its subresource PatientStateResource (supported class PatientState). But again, there’s nothing in the wiki (btw does anyone know about the status of Swagger documentation?).

And the url format should be: POST /ws/rest/v1/programenrollment/{uuid}/state/{uuid}

Check ProgramEnrollmentController1_8Test for examples.

Oh right, this is it! Please ignore my comments about creating a ticket…

I understand that this code has been merged, but a new version of the module has not been released yet. So, the next release of the REST web services module will include this.

@wyclif, is there any reason we shouldn’t release the REST module now? This is a high-value feature, and I don’t see why we should wait.