For concept
you put the UUID of the OpenMRS concept. You can find this by querying the /concept
resource, e.g.
curl -u admin:Admin123 'http://demo.openmrs.org/openmrs/ws/rest/v1/concept?q=weight'
gives
{
"results": [{
"uuid": "832AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"display": "Weight loss",
"links": [{
"rel": "self",
"uri": "NEED-TO-CONFIGURE/ws/rest/v1/concept/832AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}]
}, {
"uuid": "5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"display": "Weight (kg)",
"links": [{
"rel": "self",
"uri": "NEED-TO-CONFIGURE/ws/rest/v1/concept/5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}]
}, {
"uuid": "5090AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"display": "Height (cm)",
"links": [{
"rel": "self",
"uri": "NEED-TO-CONFIGURE/ws/rest/v1/concept/5090AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}]
}]
}
For person
, you put the UUID of the person, which you can find in the same way:
curl -u admin:Admin123 'http://demo.openmrs.org/openmrs/ws/rest/v1/person?q=mary'
gives
{
"results": [{
"uuid": "a4ea2d4a-4a4f-4215-8fdf-ee4d26d4d82d",
"display": "Mary Thomas",
"links": [{
"rel": "self",
"uri": "NEED-TO-CONFIGURE/ws/rest/v1/person/a4ea2d4a-4a4f-4215-8fdf-ee4d26d4d82d"
}]
}, {
"uuid": "41e84cf8-156f-466c-83ce-f34359d6b88f",
"display": "Mary Pérez",
"links": [{
"rel": "self",
"uri": "NEED-TO-CONFIGURE/ws/rest/v1/person/41e84cf8-156f-466c-83ce-f34359d6b88f"
}]
}, {
"uuid": "cf0768ea-c304-4fbc-9f58-4a22e8333d0b",
"display": "Mary Miller",
"links": [{
"rel": "self",
"uri": "NEED-TO-CONFIGURE/ws/rest/v1/person/cf0768ea-c304-4fbc-9f58-4a22e8333d0b"
}]
}, {
"uuid": "63baaa21-a9d5-405e-b0e9-d2c3c4ac2403",
"display": "Mary Phillips",
"links": [{
"rel": "self",
"uri": "NEED-TO-CONFIGURE/ws/rest/v1/person/63baaa21-a9d5-405e-b0e9-d2c3c4ac2403"
}]
}]
}
The obsDatetime
is the date on which the observation was made. You also need to provide a value (which depends on the type of the concept). Read this and explore here to get an understanding of the OpenMRS data model.
So, if you want to capture Weight (kg)
for Mary Thomas, you would do the following:
curl -X POST -u admin:Admin123 -H "Content-Type: application/json" - d '{
"concept": "5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"person": "a4ea2d4a-4a4f-4215-8fdf-ee4d26d4d82d",
"obsDatetime": "2016-06-17T20:04:49+05:30",
"value": 65
}' "http://demo.openmrs.org/openmrs/ws/rest/v1/obs"