: Error while creating a new user through web api (Dhis2.25) Error : attempted to assign id from null one-to-one property [org.hisp.dhis.user.UserCredentials.userInfo]" Payload I am using: Payload:
Error : attempted to assign id from null one-to-one property [org.hisp.dhis.user.UserCredentials.userInfo]"
Payload I am using:
Payload: {
"firstName": "John",
"surname": "Doe",
"email": "johndoe@mail.com",
"userCredentials": {
"username": "johndoe",
"password": "your-password-123",
"userRoles": [ {
"id": "Euq3XfEIEbx"
} ]
},
"organisationUnits": [ {
"id": "ImspTQPwCqd"
} ],
"userGroups": [ {
"id": "vAvEltyXGbD"
} ]
}
Why is this happening on 2.25 build revision edc697d?
More posts by @Harper822
1 Comments
Sorted by latest first Latest Oldest Best
For this to work properly (currently) you need to generate an ID (/api/system/id) and then modify the payload like this:
{
"id": "generated-id",
"firstName": "John",
"surname": "Doe",
"email": "johndoe@mail.com",
"userCredentials": {
"userInfo": { "id": "generated-id" },
"username": "johndoe",
"password": "your-password-123",
"userRoles": [ {
"id": "Euq3XfEIEbx"
} ]
},
"organisationUnits": [ {
"id": "ImspTQPwCqd"
} ],
"userGroups": [ {
"id": "vAvEltyXGbD"
} ]
}
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2025 All Rights reserved.