← Back to team overview

dhis2-devs team mailing list archive

Re: Update User Password Via Web API

 

Hi Morten

Yes absolutely. This is the payload that I'm sending :

{
    "id": "ogzPPGeR3je",
    "name": "Joe Soap",
    "displayName": "Joe Soap",
    "surname": "Soap",
    "firstName": "Joe",
    "userCredentials": {
        "id": "l0LtVrLx9rn",
        "username": "",
        "password":"Password@1#",
        "userInfo": {
            "id": "ogzPPGeR3je"
        },
        "user": {
            "id": "sYPA2WEAwF8"
        },
        "userRoles":[
{
"id":"oxkpIDF5yNe"
},
{
"id":"V3pb8xpnDnM"
},
{
"id":"B1cxBsDczWI"
},
{
"id":"saLI2pdSaI7"
},
{
"id":"XaVXiwNYTvf"
},
{
"id":"VyFlshFvGlW"
},
{
"id":"pqV3wvWzg3Z"
}
],
"userAccesses":[
]
    },
    "userGroups": [
        {
            "id": "BTQxAAEIjyJ"
        },
        {
            "id": "lWaxJV3AWIo"
        }
    ],
    "organisationUnits":[
{
"id":"JLA7wl59oN3"
}
],
"dataViewOrganisationUnits":[
{
"id":"JLA7wl59oN3"
}
],
    "attributeValues": [
        {
            "lastUpdated": "2017-10-12T12:26:20.700",
            "created": "2017-10-12T12:26:20.695",
            "value": "BRO001",
            "attribute": {
                "id": "bLr1v9A0XaW"
            }
        },
        {
            "lastUpdated": "2017-10-12T12:26:20.697",
            "created": "2017-10-12T12:26:20.695",
            "value": "Monitoring and Evaluation",
            "attribute": {
                "id": "EkBIN7Ow26B"
            }
        },
        {
            "lastUpdated": "2017-10-12T12:26:20.700",
            "created": "2017-10-12T12:26:20.695",
            "value": "6008110043087",
            "attribute": {
                "id": "w8br4js83bo"
            }
        },
        {
            "lastUpdated": "2018-01-22T12:36:08.156",
            "created": "2018-01-22T12:36:08.153",
            "value": "--  Select --",
            "attribute": {
                "id": "bCNA5mqP6Az"
            }
        }
    ]
}

The summary response I get after posting the payload is :

{"importParams":{"importMode":"COMMIT","identifier":"UID","preheatMode":"REFERENCE","importStrategy":"UPDATE","atomicMode":"ALL","mergeMode":"REPLACE","flushMode":"AUTO","skipSharing":false,"skipValidation":false,"username":"Farai_Mutero"},"status":"OK","typeReports":[{"klass":"org.hisp.dhis.user.User","stats":{"created":0,"updated":1,"deleted":0,"ignored":0,"total":1},"objectReports":[{"klass":"org.hisp.dhis.user.User","index":0,"uid":"ogzPPGeR3je"}]}],"stats":{"created":0,"updated":1,"deleted":0,"ignored":0,"total":1}}

On Mon, Mar 26, 2018 at 5:14 PM, Morten Olav Hansen <morten@xxxxxxxxx>
wrote:

> What you provide here is just the summary report...
>
> To change a password, you need to add "password" field to the
> "userCredentials" part of the payload... are you doing that?
>
> --
> Morten Olav Hansen
> Senior Engineer, DHIS 2
> University of Oslo
> http://www.dhis2.org
>
> On Mon, Mar 26, 2018 at 6:25 PM, Farai Mutero <fmutero@xxxxxxxxx> wrote:
>
>> Hi All
>>
>> We are looking at automating the process of resetting of a user's
>> password when the password expires  I'm trying to update the user password
>> via the WebAPI. I carefully prepare the payload as dictated by the
>> documentation and the API sends back a response as below that the user has
>> been updated, but the password does not change, the old password still
>> works even after providing a new one in the payload. How can I solve this
>> problem?
>>
>> {"importParams":{"importMode":"COMMIT","identifier":"UID","p
>> reheatMode":"REFERENCE","importStrategy":"UPDATE","atomicMod
>> e":"ALL","mergeMode":"REPLACE","flushMode":"AUTO","skipShari
>> ng":false,"skipValidation":false,"username":"Farai_
>> Mutero"},"status":"OK","typeReports":[{"klass":"org.
>> hisp.dhis.user.User","stats":{"created":0,"updated":1,"
>> deleted":0,"ignored":0,"total":1},"objectReports":[{"klass":
>> "org.hisp.dhis.user.User","index":0,"uid":"ogzPPGeR3je"}]
>> }],"stats":{"created":0,"updated":1,"deleted":0,"ignored":0,"total":1}}
>>
>> --
>> Farai Mutero
>>
>>
>> _______________________________________________
>> 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
>>
>>
>


-- 
Farai Mutero

References