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 <
[email protected]> 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
>
_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to