← Back to team overview

dhis2-devs team mailing list archive

Re: Is it possible to change the passwd of the users using the API??

 

Thanks for the clarification.

Unfortunately it is still not working (likely because I am doing something
wrong). So the call to the API that I tried is:

....api/users/zNdlm77vil8/userCredentials

and the payload:

{
  "password": "the_new_passwd",
  "id": "AMuabF1Lrct", (the id of the user credentials)
  "name": "user_name",
  "code": "user_code"
}

But the system gives me the error: "Unknown payload format"

Any ideas? I think it is better if you could send me the call to the API
and the format of the payload.

Many thanks
Jose

On Tue, Feb 10, 2015 at 4:51 AM, Morten Olav Hansen <mortenoh@xxxxxxxxx>
wrote:

> Yes, sorry. You will need to patch the full userCredentials part of the
> user (its at least a bit smaller than the whole user payload)
>
> --
> Morten
>
> On Tue, Feb 10, 2015 at 1:54 AM, Lars Helge Øverland <larshelge@xxxxxxxxx>
> wrote:
>
>> Hi, it should be on the userCredentials object.
>>
>> On Mon, Feb 9, 2015 at 7:17 PM, Jose Garcia Muñoz <josemp10@xxxxxxxxx>
>> wrote:
>>
>>>
>>> Thanks Jason, Morten,
>>>
>>> Morten, I have tried with the 2.18. However, I am getting the following
>>> answer "Property password does not exist on org.hisp.dhis.user.User"
>>>
>>> On Mon, Feb 9, 2015 at 12:58 PM, Jason Pickering <
>>> jason.p.pickering@xxxxxxxxx> wrote:
>>>
>>>> Easiest was would be to GET the current payload of the user,modify the
>>>> password to what you want and the POST this payload back, if you are on
>>>> 2.17.
>>>>
>>>> Regards,
>>>> Jason
>>>> On Feb 9, 2015 12:56 PM, "Jose Garcia Muñoz" <josemp10@xxxxxxxxx>
>>>> wrote:
>>>>
>>>>>
>>>>> Thanks Jason,
>>>>>
>>>>> nope, I am using the 2.17. But will migrate to the 2.18 this
>>>>> afternoon. Will test it and let you know.
>>>>>
>>>>> So in the 2.17 I would need to introduce all the information of the
>>>>> user again in the payload?
>>>>>
>>>>> Thanks
>>>>> Jose
>>>>>
>>>>> On Mon, Feb 9, 2015 at 12:46 PM, Morten Olav Hansen <
>>>>> mortenoh@xxxxxxxxx> wrote:
>>>>>
>>>>>> You need to send the full payload. Are you on 2.18? you could use
>>>>>> PATCH for this now.. something like
>>>>>>
>>>>>> {
>>>>>>   "password": "new-password"
>>>>>> }
>>>>>>
>>>>>> curl -X PATCH -d @password.json -u user:pass
>>>>>> http://localhost:8080/api/users/ID/password
>>>>>>
>>>>>> (untested, but should work)
>>>>>>
>>>>>> --
>>>>>> Morten
>>>>>>
>>>>>> On Mon, Feb 9, 2015 at 6:43 PM, Jose Garcia Muñoz <josemp10@xxxxxxxxx
>>>>>> > wrote:
>>>>>>
>>>>>>>
>>>>>>> Thanks Jason,
>>>>>>>
>>>>>>> sorry, and how should it work? I tried with the following call...
>>>>>>>
>>>>>>> curl.exe -d @user.json "
>>>>>>> http://localhost:8080/dhis/api/users/oEiOvqVp3A9"; -H
>>>>>>> "Content-Type:application/json" -u myuser:mypasswd -v
>>>>>>>
>>>>>>> where the user.json file just contains
>>>>>>>
>>>>>>> {
>>>>>>>   "username": "the_user_name",
>>>>>>>   "password": "the_user_passwd"
>>>>>>> }
>>>>>>>
>>>>>>> But the system gives me an error
>>>>>>>
>>>>>>> Am I missing something?
>>>>>>>
>>>>>>> Thanks
>>>>>>> Jose
>>>>>>>
>>>>>>> On Mon, Feb 9, 2015 at 6:13 AM, Jason Pickering <
>>>>>>> jason.p.pickering@xxxxxxxxx> wrote:
>>>>>>>
>>>>>>>> Hi Jose,
>>>>>>>>
>>>>>>>> Yes, it is possible to send the plain-text password of a user to the
>>>>>>>> system using the API, which will then hash the password for you and
>>>>>>>> persist it in the database.
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> Jason
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Feb 9, 2015 at 1:04 AM, Jose Garcia Muñoz <
>>>>>>>> josemp10@xxxxxxxxx> wrote:
>>>>>>>> >
>>>>>>>> > Hi devs,
>>>>>>>> >
>>>>>>>> > I didn't see anything in the documentation in that regard. I
>>>>>>>> could only find
>>>>>>>> > out the user replication as the only way to specify a user passwd
>>>>>>>> using the
>>>>>>>> > API. Am I correct?
>>>>>>>> >
>>>>>>>> > Thanks
>>>>>>>> > Jose
>>>>>>>> >
>>>>>>>> > _______________________________________________
>>>>>>>> > 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
>>>>>>>> >
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Jason P. Pickering
>>>>>>>> email: jason.p.pickering@xxxxxxxxx
>>>>>>>> tel:+46764147049
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>>
>> _______________________________________________
>> 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