SCIM-bulk create user
Closed this issue · 2 comments
Hi,
Iam calling bulk users api for creating users, so if a user is already exists, response coming as 409 and next users are not creating and returing the response till that. For example iam sending 10 users in bulk request and 5th user is already exists, then returing response there and request not executing from 6th record onwards. Iam expecting like if 409 is coming also it should create next users. Could you help on me this
this can be accustomed with the "failOnErrors" parameter. If no value is set default is set to 1:
{
"schemas": ["urn:ietf:params:scim:api:messages:2.0:BulkRequest"],
"failOnErrors": 1,
"Operations"
...
}
set the value e.g. to 100 to allow up to 100 errors per request.
I tried to recreate your issue and wasn't able to verify it. My previous post was not correct. The default is not set to 1 but set to Integer.MAX_VALUE meaning that if failOnErrors is not set it should not abort on a failed operation. And my test-scenario was giving me exactly the expected result:
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:BulkRequest"
],
"Operations": [
{
"method": "POST",
"bulkId": "144b4d09-ed96-45a9-aff4-6f603d23dba9",
"path": "/Users",
"data": {
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"userName": "abagael"
}
},
{
"method": "POST",
"bulkId": "a05f499a-c798-49ea-aec6-5e79de77ded4",
"path": "/Users",
"data": {
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"userName": "abbe"
}
},
{
"method": "POST",
"bulkId": "722fd20f-7bce-45b1-8e53-def3509ccf02",
"path": "/Users",
"data": {
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"userName": "aaren"
}
},
{
"method": "POST",
"bulkId": "1af6e7ee-4ff6-4ac4-b924-dcc1d71c58e2",
"path": "/Users",
"data": {
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"userName": "abagail"
}
},
{
"method": "POST",
"bulkId": "6b7f7dc5-1c97-487b-86a6-39a31c155e4c",
"path": "/Users",
"data": {
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"userName": "aarika"
}
}
]
}
resulted in
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:BulkResponse"
],
"Operations": [
{
"method": "POST",
"bulkId": "144b4d09-ed96-45a9-aff4-6f603d23dba9",
"status": 409,
"response": {
"detail": "the username 'abagael' is already taken",
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:Error"
],
"status": 409
}
},
{
"method": "POST",
"bulkId": "a05f499a-c798-49ea-aec6-5e79de77ded4",
"id": "f67e34c9-2025-4e4c-8ea1-05eb8996de21",
"location": "http://localhost:8080/auth/realms/scim/scim/v2/Users/f67e34c9-2025-4e4c-8ea1-05eb8996de21",
"status": 201
},
{
"method": "POST",
"bulkId": "722fd20f-7bce-45b1-8e53-def3509ccf02",
"status": 409,
"response": {
"detail": "the username 'aaren' is already taken",
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:Error"
],
"status": 409
}
},
{
"method": "POST",
"bulkId": "1af6e7ee-4ff6-4ac4-b924-dcc1d71c58e2",
"id": "52c27963-0cd5-4f4a-a3c1-ecacb98eb92a",
"location": "http://localhost:8080/auth/realms/scim/scim/v2/Users/52c27963-0cd5-4f4a-a3c1-ecacb98eb92a",
"status": 201
},
{
"method": "POST",
"bulkId": "6b7f7dc5-1c97-487b-86a6-39a31c155e4c",
"status": 409,
"response": {
"detail": "the username 'aarika' is already taken",
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:Error"
],
"status": 409
}
}
]
}
two of these requests were successful and all others resulted in a conflict. I could confirm that the created users were present within the database afterwards