dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #32359
Re: Assigning org unit to program via API
Hi Mahendra
If you want to update a program, you need to use a PUT request to the
/api/programs/id
It's saying "Object already exists" because the uid already exists in the
system.
Btw, you need to send the full payload, we don't support partial updates.
--
Morten
On Tue, Aug 26, 2014 at 4:06 PM, Mahendra Kariya <
mahendra.kariya@xxxxxxxxxxxxxxxx> wrote:
> Hi,
>
> We are trying to assign org units to an existing Program via web api.
>
> We tried the posting the below payload to /api/programs, but it is
> throwing an error "Object already exists".
>
> {
> "id": "adb81a4bc13"
> "organisationUnits": [
> {
> "id": "a2cf79e8f13"
> },
> {
> "id": "b876de81d4e"
> }
> ]
> }
>
> We tried posting the following payload to /api/metadata, but it is
> throwing constraint violation error.
> {
> "programs": [
> {
> "id": "adb81a4bc13",
> "organisationUnits": [
> {
> "id": "a2cf79e8f13"
> },
> {
> "id": "b876de81d4e"
> }
> ]
> }
> ]
> }
>
> Could you guys point us to the correct payload format?
>
>
> Thanks,
> Mahendra
> *Thought*Works
>