← Back to team overview

dhis2-devs team mailing list archive

Re: POSTing orgUnitGroups and orgUnits in one transaction

 

Hi Mahendra

No, this is not currently supported. We are working on it, and we might
have something for 2.20 (you would have to use PUT
/api/organisationUnits/ID).

This is happening because our importer is very generic in nature, so before
it didn't know which side is the owning side, and in this case, the ouGroup
is the owner of that association, we have now added this to our Schema, so
when we rewrite the importer, we can use this information to support
updating both sides of an association.

--
Morten

On Mon, Apr 27, 2015 at 11:39 AM, Mahendra Kariya <
mahendra.kariya@xxxxxxxxxxxxxxxx> wrote:

> Hi Morten,
>
> We are trying to update org units and org unit groups in one transaction.
> We tried POSTing the following payload to /api/metadata, but it seems
> that organisationUnitGroups object in the payload is getting ignored.
>
> {
>   "organisationUnits": [
>     {
>       "id": "oisw12e6d4e",
>       "level": 3,
>       "name": "A Test Country",
>       "shortName": "TestCountry",
>       "openingDate": "1900-01-01",
>       "parent": {
>         "id": "q1c4bsa3e2b",
>         "name": "parent"
>       },
>       "organisationUnitGroups": [
>         {
>           "id": "z83f29ic9b8",
>           "name": "Hospital"
>         }
>       ],
>       "children": [],
>       "dataSets": [],
>       "attributeValues": [],
>       "userGroupAccesses": []
>     }
>   ]
> }
>
> P.S. Another way to do this is would be to POST organisationUnits and
> organisationUnitGroups as separate object to /api/metadata, but that's not
> what we are looking for. We want to send it as same object.
>
>
>
>