Generic Tagging Module - Technical Documentation

Background

See the Generic Tagging Module documentation on the OpenMRS wiki

for more information.

Resource

The Tag Resource exposes the Generic tagging module allowing users to fetch data from the database by making REST Calls.

URLs

tagdescription
GET /ws/rest/v1/tag/{uuid}Fetch by unique uuid
GET /ws/rest/v1/tag/{tag}Fetches by tag name
GET /ws/rest/v1/tag?objectType={objecttype}&tag={tag}Fetches based on 2 params:- object type (Java Class Name Of Object) and Tag
GET /ws/rest/v1/tag?objectType={objecttype}&objectUuid={objectuuid}Fetches based on 2 params:- object type (Java Class Name Of Object) and object uuid (unique uuid of object)
POST /ws/rest/v1/tagCreate with properties in request
DELETE /ws/rest/v1/tag/{uuid}?purgeDelete this object from the database

Representations

Get refGet defaultGet fullPost create

uuid

tag(display)

links

uuid

tag (display)

objectUuid

objectType

links
resourceVersion

uuid

tag (display)

objectUuid

objectType

auditInfo

links

resourceVersion

tag

objectType

object Uuid

Sample Rest Calls

Adding a tag to an openmrs object
POST /ws/rest/v1/tag
Body content:
{"tag": "Important", "objectType": "org.openmrs.Concept", "objectUuid": "9e43bcca-66e7-4ecb-b1b6-75d2d5cc171c"}
Default get request example
GET /ws/rest/v1/tag/{uuid}

{
    "tag": "Important Patient",
    "uuid": "35f1dfb9-01dc-40f1-b082-0ee9b941cefa",
    "objectType": "org.openmrs.Patient",
    "objectUuid": "6a952bf4-0a97-48a5-b462-68459534a9ec",
    "links": [
        {
            "rel": "v1/patient",
            "uri": "http://localhost:8081/openmrs/ws/rest/v1/patient/6a952bf4-0a97-48a5-b462-68459534a9ec"
        },
        {
            "rel": "self",
            "uri": "http://localhost:8081/openmrs/ws/rest/v1/tag/35f1dfb9-01dc-40f1-b082-0ee9b941cefa"
        },
        {
            "rel": "full",
            "uri": "http://localhost:8081/openmrs/ws/rest/v1/tag/35f1dfb9-01dc-40f1-b082-0ee9b941cefa?v=full"
        }
    ],
    "resourceVersion": "1.8"
}