Okay, thanks!

Olav


> 9. feb. 2017 kl. 08.43 skrev Mark Polak <[email protected]>:
> 
> Hey Olav,
> 
> PATCH doesn't really work for object references. You can try to download the 
> whole object and PUT it back ;)
> 
> So basically GET -> 
> https://play.dhis2.org/demo/api/dataSets/lyLU2wR22tC.json?fields=:owner 
> <https://play.dhis2.org/demo/api/dataSets/lyLU2wR22tC.json?fields=:owner>
> 
> Change user id on the returned object.
> 
> Then PUT that payload back to -> 
> https://play.dhis2.org/demo/api/dataSets/lyLU2wR22tC.json 
> <https://play.dhis2.org/demo/api/dataSets/lyLU2wR22tC.json>
> 
> On Wed, Feb 8, 2017 at 10:01 AM, Olav Poppe <[email protected] 
> <mailto:[email protected]>> wrote:
> Hi devs, 
> I’m trying to set the owner of an object using the API (using PATCH), but it 
> fails.
> 
> Example (agains /demo):
> curl -X PATCH -H «Content-Type: application/json" -u admin:district -d ‘{ 
> "user": { "id": "dXKBEMfyChY" } }' 
> "https://play.dhis2.org/demo/api/dataSets/kS1CX1YBcl1/user 
> <https://play.dhis2.org/demo/api/dataSets/kS1CX1YBcl1/user>" -v
> 
> Result: 
> {«httpStatus":"Internal Server 
> Error","httpStatusCode":500,"status":"ERROR","message":"object references an 
> unsaved transient instance - save the transient instance before flushing: 
> org.hisp.dhis.user.User"}
> 
> Is this a bug, or have I misunderstood how to do this?
> 
> Regards
> Olav
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs 
> <https://launchpad.net/~dhis2-devs>
> Post to     : [email protected] 
> <mailto:[email protected]>
> Unsubscribe : https://launchpad.net/~dhis2-devs 
> <https://launchpad.net/~dhis2-devs>
> More help   : https://help.launchpad.net/ListHelp 
> <https://help.launchpad.net/ListHelp>
> 
> 
> 
> 
> -- 
> Regards,
> 
> 
> Mark Polak
> Software developer, DHIS 2
> University of Oslo
> http://www.dhis2.org <https://www.dhis2.org/>
> [email protected] <mailto:[email protected]>

_______________________________________________
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