Dewald_Smit | 2024-07-10 21:29:26 UTC | #1
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.
Jerome.Saint-Marc | 2024-07-11 11:27:25 UTC | #2
Hello,
Dewald_Smit, post:1, topic:27184
When you update from UI and check network tab in dev tools, the request looks like this and works:
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,
Dewald_Smit | 2024-07-11 11:50:55 UTC | #3
Jerome.Saint-Marc, post:2, topic:27184
ATCH /api/v2/users/{userId}, the Request body would be 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:
system | 2024-08-10 11:51:05 UTC | #4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 27184