Created user with rest API does not exist immediately after creation

ulrik_sandgren
Community Explorer

Hi

This is what I found when I checked our logs in our integration:

PostAsync uri:/api/v1/accounts/self/users, body:{ "user": { "name": "xx yy", "short_name": "xx yy", "sortable_name": "yy, xx", "terms_of_use": true }, "pseudonym": { "unique_id": "xxxyyy@umu.se", "sis_user_id": "zz" }, "communication_channel": { "type": "email", "address": "xx.yy@umu.se" }} 2020-04-24 10:08:18Z 17772 17
Leave CanvasService:AddNewUser() result: Id: xxxyyy@umu.se, UserId: 914 2020-04-24 10:08:19Z 17772 17
Enter CanvasService:EnrolUser() EnrolmentDto: TargetSystem: CANVAS, Site: {Person: {Id: xxxyyy 2020-04-24 10:08:19Z 17772 17
GetAsync uri:/api/v1/accounts/self/users?search_term=xxxyyy@umu.se 2020-04-24 10:08:19Z 17772 17
GetAsync uri:/api/v1/accounts/self/users?search_term=xxxyyy@umu.se 2020-04-24 10:08:20Z 17772 17
GetAsync uri:/api/v1/accounts/self/users?search_term=xxxyyy@umu.se 2020-04-24 10:08:23Z 17772 17

As you can see the user was created and a user id was returned, then a short time after the user is going to be enroled but Canvas can not find the user and the program makes 2 retries with a delay and finally finds the user.

Can anyone explain what is happening here, why does not Canvas find the user in the first attempt?