dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40532
Updating the password of one user using PATCH in the Web API (2.20)
Hi Morten, all,
We need to update the passwords of several users using the Web API. We are
trying the following API call:
curl -X PATCH -d @file.json -u myuser:mypass
http://localhost:8080/dhis/api/users/yhQ0Ma7CLNw/userCredentials -H
"Content-Type: application/json"
Where the json file is:
{"username":"theuser", "name":"user name", "password":"thenewpassword",
"code":"theuser","created":"2015-03-16T14:00:24.057+0000"}
however I am getting the following message:
{"httpStatus":"OK","httpStatusCode":200,"status":"OK","message":"Import was
successful.","response":{"responseType":"ImportTy
peSummary","status":"SUCCESS","importCount":{"imported":0,"updated":0,"ignored":1,"deleted":0},"type":"User","importConflicts
":[{"object":"theuser","value":"User is missing userCredentials part."}]}}
Any ideas? Am I missing something?
I have also noted, that this call
http://localhost:8080/dhis/api/users/yhQ0Ma7CLNw/userCredentials.json is
not returning the username field, but instead seems to be returned in the
code??
userCredentials:
{
- code: "theuser", //Shouldn't be username instead of code???
- created: "2015-03-16T14:00:24.057+0000",
- name: "Peter",
- selfRegistered: false,
- -..........................
Many thanks for your help
Best regards
Jose
Follow ups