← Back to team overview

dhis2-devs team mailing list archive

Assigning an Org. Unit Group to a Org. Unit with the API

 

Hi devs,

So, I am trying to do it in one step (create the org.unit + assign one org.
unit group) using the following API call:

http://localhost:8080/dhis/api/organisationUnits

and the payload:

{
"name":"The name",
"shortName":"Short name",
"parent":{
"id":"wSkI02omzoJ"
},
"openingDate":"2015-03-03",
"organisationUnitGroups": [
{"id":"BW7NafIFfrS",
"name":"Project",
"created":"2014-11-18T15:56:01.136+0000",
"lastUpdated":"2014-11-27T14:20:38.381+0000"}
]
}

However, although the org unit is created and we get a SUCCESS message, the
org. unit group is not associated to the org. unit.

Also I tried, in 2 steps (when the org unit is already in the system),
something like this:

API: http://localhost:8080/dhis/api/organisationUnitGroups/

{
"id":"BW7NafIFfrS",
"organisationUnits":[{"id":"Tynta6mhuLQ"}]
}

But nothing happens

Which is the best way to do this?

Thanks

Best regards
Jose

Follow ups