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": "[email protected]",
  "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?

0

1 Answer 1

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": "[email protected]",
  "userCredentials": {
    "userInfo": { "id": "generated-id" },
    "username": "johndoe",
    "password": "your-password-123",
    "userRoles": [ {
      "id": "Euq3XfEIEbx"
    } ]
  },
  "organisationUnits": [ {
    "id": "ImspTQPwCqd"
  } ],
  "userGroups": [ {
    "id": "vAvEltyXGbD"
  } ]
}
1
  • Thanks for the solution @mortenoh. Have used above payload and it is working fine now. Jan 3, 2017 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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