← Back to team overview

dhis2-devs team mailing list archive

Re: User PUT issue

 

Thank you Hendrik.  PATCH is the way to go for most objects. Unfortunately
(per or discussion and here for posterity) it does not currently work with
user.userGroupos and user.userCredentials.userRoles. I will need to make a
clean copy of the user object and PUT.

*Gregory Wilson*

On Tue, Aug 14, 2018 at 8:16 AM Hendrik de Graaf <hendrik@xxxxxxxxx> wrote:

> Hi Gregory,
>
> For updating a single field on a user record, I would try doing a PATCH
> request with exactly the same payload as you were doing.
>
> I do this type of request to disable a user in the User Management app, so
> it should work.
>
> Best regards,
> Hendrik
> On 14 Aug 2018, 11:16 +0200, Greg Wilson <gwilson@xxxxxxxxxxxxxx>, wrote:
>
> Can someone tell me what I am doing wrong here? According to the docs (
> https://docs.dhis2.org/2.29/en/developer/html/dhis2_developer_manual_full.html#webapi_users_create_update)
> this should work to update a user's account:
>
> curl -X PUT -u "admin:district" -d @u.json -H "Content-Type:
> application/json" https://play.dhis2.org/2.26/api/26/users/DXyJmlo9rge
>
> In this case I am using {"firstName":"ATEST"} as the u.json file.
> Unfortunately I keep receiving errors such as:
>
> "Missing required property `surname`."
>
> If I send a more complete user object it complains that I am missing the
> userCredentials.username property. When I add that, it complains that user
> already exists.
>
> *Gregory Wilson*
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help : https://help.launchpad.net/ListHelp
>
>

Follow ups

References