2

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?

2

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"
  } ]
}
  • Thanks for the solution @mortenoh. Have used above payload and it is working fine now. – Sourabh Bhardwaj Jan 3 '17 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.