Hello,
One of the GSoC projects this summer is about handling generic tagging in OpenMRS, we want to make sure we know what the rest API for tagging should look like and then design the java API with it in mind. Below is what I have as the initial draft of the rest API;
Set tag(s) for an object which should effectively support adding/removing tags
POST .../ws/rest/v1/tag {"type": "patient", "uuid": "patient-uuid", "tags": ["tag1"]} //Add tag1 to a patient
POST .../ws/rest/v1/tag {"type": "patient", "uuid": "patient-uuid", "tags": ["tag1", "tag2"]} //Add tag2 to a patient
POST .../ws/rest/v1/tag {"type": "patient", "uuid": "patient-uuid", "tags": ["tag1"]} //Should effectively remove tag2 from the previous patient
OR
POST .../ws/rest/v1/patient/patient-uuid {...., "tags": ["tag1"]} //Add tag1 to a patient
POST .../ws/rest/v1/patient/patient-uuid {...., "tags": ["tag1", "tag2"]} //Add tag2 to a patient
POST .../ws/rest/v1/patient/patient-uuid {...., "tags": ["tag1"]} //Should effectively remove tag2 from a patient
In the first option, we resolve the java type from the resource that matches the concatenation of the version and the specified type field
Get all objects with the specified tag(s) and of the given type(s), tags should be required and types should be optional.
GET .../ws/rest/v1/tag?type=patient,concept&tag=tag1,tag2
Fetching any resource should Include its tags for the full representation
GET .../ws/rest/v1/patient?v=full
Returns:
{
uuid: "some-uuid",
person: {},
identifiers : [{}],
tags: ["tag1", "tag2"],
.... //Other fields
}
Ideas are welcome, thanks!