← Back to team overview

dhis2-devs team mailing list archive

Question about api, org unit relationships

 

Hi,

I have some questions about the API. For now I am using 2.24.

I figured that to add a parent to an organisation unit, I have to PUT the
child with parent field.
1) I wonder why PATCH does not work in this case:
PATCH http://127.0.0.1:8080/api/organisationUnits/uwxbuyaEU2j {
    "parent": { "id": "hyAZBROiSX5" }
}
or even
POST
http://127.0.0.1:8080/api/organisationUnits/hyAZBROiSX5/children/uwxbuyaEU2j

---

Now, I can not find how to remove the parent/child relationship.
I tried:
DELETE
http://127.0.0.1:8080/api/organisationUnits/hyAZBROiSX5/children/uwxbuyaEU2j
DELETE
http://127.0.0.1:8080/api/organisationUnits/uwxbuyaEU2j/ancestors/hyAZBROiSX5
PUT  http://127.0.0.1:8080/api/organisationUnits/uwxbuyaEU2j {
    "openingDate": "2016-12-30",
    "name": "org unit2",
    "shortName": "ou2",
    "parent": { "id": null }
}
2) could you please tell me what is the appropriate way?

Thanks,

Benjamin

Follow ups