← Back to team overview

dhis2-devs team mailing list archive

API: persons - add person

 

I just wanted to send out a template payload that works with the latest version of the DHIS2 api:

{
   "orgUnit": "EKblHmIUjnm",
   "identifiers": [ {
       "displayName": "NationalId",
       "type": "string",
       "identifier": "crnUc1S13Lk",
       "value": 124565
       }],
   "attributes": [ {
       "attribute": "FfRwG4gTlNH",
       "type": "string",
       "value": "testname"
   }
   ]
}

Where identifier is the uid of the identifier type, and value is the actual id to be added

Response will be "HTTP/1.1 201 Created" for a valid document
Payload will begin with a status flag - examples below
{"status":"SUCCESS","importCount  ":{"imported":1, "updated":0,"ignored":0,"deleted  ":0},"reference" :"icaWfFMW9Y"} 
{"status":"ERROR  ","importCount": {"imported":0,"updated":0,"ignored":1,"deleted": 0},"conflicts":[{"object":"Identifier.value","value":"Value already exists for patient icaWfFMW9Y with identifier type crnUc1S13Lk"}]}