← Back to team overview

dhis2-devs team mailing list archive

Re: User password reset through API

 

Hi Muhammad,

Make sure you include the `userCredentials.id` field in your PUT request too. That should be enough for updating a user.

However, when you want to set fields for a new user (POST request), you must make sure to also to create a `userCredentials.userInfo.id` field.

You can use the d2 `generateUid` method ( http://dhis2.github.io/d2/module-uid.html#.generateUid) to generate a uuid on the client.

Good luck,
Hendrik


On 31 Mar 2018, 17:21 +0200, Hannan Khan <hannank@xxxxxxxxx>, wrote:
> Hello Experts
>
> Hope you are all enjoying Easter.
>
> I am trying to reset/update password through API. Is it possible to send PUT request with jason payload with only ID, username and password? I use
>
> curl -X PUT -u user:pass -d @u.json -H "Content-Type: application/json" https://server/api/26/users/ID
>
>  I am getting following error:
>
> {"httpStatus":"Conflict","httpStatusCode":409,"status":"ERROR","message":"org.hisp.dhis.user.User does not exist: ID"}
>
> Please advice.
>
> Regards
> --
> Muhammad Abdul Hannan Khan
> Team Leader
> Support to the National HMIS
> MIS, Director General of Health Service
> Ministry of Health and Family Welfare
>
> T +880-2- 58816459, 58816412 ext 118
> F +88 02 58813 875
> M+88 01819 239 241
> M+88 01534 312 066
> E hannank@xxxxxxxxx
> S hannan.khan.dhaka
> B hannan-tech.blogspot.com
> L https://bd.linkedin.com/in/hannankhan
>
>
>
> _______________________________________________
> 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

References