Patch Update User cannot update Employer Info ?bug?

Good day Team,

I have run into a problem with PATCH /api/v2/users/{userId}.
When I try and update employerInfo

"employerInfo": {
"officialName": "Dewald",
"employeeId": "123456",
"employeeType": "Full-time",
"dateHire": "2010-08-02"
},

It gives malformed syntax error.
But if I change employerInfo to hr then i dont get the error.

When you update from UI and check network tab in dev tools, the request looks like this and works:

{"hr":{"officialName":[{"value":"Dewald","_id":"5ZbgHnWkHaTBbXcnnTO3h1","labelKey":"officialName","tempId":"ember1691"}],"empId":[{"value":"123456","_id":"hp4LqhfglxR7FYTVXOl5f","labelKey":"empId","tempId":"ember1696"}],"empType":[{"labelKey":"empType","value":"Full-time","_id":"5UsmomZKmPKSslAzp1fFY4","tempId":"ember1701"}],"hireDate":[{"labelKey":"hireDate","value":{"year":2010,"month":8,"day":2},"_id":"1AJMbZRIhpi1U1xk47SNHg","tempId":"ember1709"}],"emergencyContactInfo":[]},"version":5}

When I try to mirror these values on the Developer Tools the fields do not update on the user profile and no error received, increments user version.

inin-correlation-id b95a8b65-b373-4d7f-b91c-6a65c8ee509c

Request body:

{
"version": 8,
"hr": {
"officialName": "Dewald S",
"employeeId": "A12345",
"employeeType": "Full-time",
"dateHire": "2010-08-02"
}
}

Then run Get user:

"version": 9,
"employerInfo": {
"officialName": "Dewald",
"employeeId": "123456",
"employeeType": "Full-time",
"dateHire": "2010-08-02"
},

Please put me out of my misery, haha.

Hello,

The UI is NOT invoking this endpoint. It is leveraging another API endpoint which is not public - PUT /api/v2/users/{userId}/profile

Using PATCH /api/v2/users/{userId}, the Request body would be like:

{
  "employerInfo": {
    "officialName": "Dewald S",
    "employeeId": "A12345",
    "employeeType": "Full-time",
    "dateHire": "2010-08-02"
  },
  "version": 9
}

Regards,

1 Like

Thanks Jerome,

Get user:

"state": "active",
"title": "Test Agent",
"username": "d@test.co.za",
"version": 9,
"employerInfo": {
"officialName": "Dewald",
"employeeId": "123456",
"employeeType": "Full-time",
"dateHire": "2010-08-02"
},
"preferredName": "Dewald Smit",
"acdAutoAnswer": true,
"selfUri": "/api/v2/users/397972ef-7362-402d-b382-ab4bff3b8ef1"
}

Run this:
{
"employerInfo": {
"officialName": "Dewald S",
"employeeId": "A12345",
"employeeType": "Full-time",
"dateHire": "2010-08-02"
},
"version": 9
}

This has now worked. I don't understand, must have been a long day.
But i was running it like this from the empty schema, removing sections i don't need, and it would not do anything untill i changed "employerInfo" to "hr". But anyway, it's working.

Ill go to bed next time and try again in the morning before i post :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.