wxc_sdk.scim.bulk package

class wxc_sdk.scim.bulk.BulkMethod(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, SafeEnum

An enumeration.

post = 'POST'
patch = 'PATCH'
delete = 'DELETE'
class wxc_sdk.scim.bulk.BulkOperation(*, method: BulkMethod | None = None, path: str | None = None, data: dict | None = None, bulkId: str | None = None)[source]

Bases: ApiModel

method: BulkMethod | None

The HTTP method of the current operation. example: PATCH

path: str | None

The resource’s relative path. If the method is POST, the value must specify a resource type endpoint, for example /Users or /Groups. All other method values must specify the path to a specific resource. example: /Users/2819c223-7f76-453a-919d-413861904646

data: dict | None

The Resource JSON data as it appears for a single POST or PATCH resource operation. example: JSON text

bulk_id: str | None

The transient identifier of a newly created resource, unique within a bulk request and created by the client. example: ytrewq

class wxc_sdk.scim.bulk.ResponseError(*, trackingId: str | None = None, errorCode: int | None = None, details: str | None = None)[source]

Bases: ApiModel

tracking_id: str | None
error_code: int | None
details: str | None
class wxc_sdk.scim.bulk.BulkErrorResponse(*, schemas: list[str] | None = None, status: int | None = None, error: ResponseError | None = None)[source]

Bases: ApiModel

schemas: list[str] | None
status: int | None
error: ResponseError | None
class wxc_sdk.scim.bulk.BulkResponseOperation(*, location: str | None = None, method: str | None = None, bulkId: str | None = None, version: str | None = None, status: int | None = None, response: BulkErrorResponse | None = None)[source]

Bases: ApiModel

location: str | None
method: str | None
bulk_id: str | None
version: str | None
status: int | None
response: BulkErrorResponse | None
property user_id: str | None
class wxc_sdk.scim.bulk.BulkResponse(*, schemas: list[str] | None = None, operations: list[BulkResponseOperation] | None = None)[source]

Bases: ApiModel

schemas: list[str] | None
operations: list[BulkResponseOperation] | None
class wxc_sdk.scim.bulk.SCIM2BulkApi(*, session: RestSession, base: str | None = None)[source]

Bases: ScimApiChild

Bulk Manage SCIM 2 Users and Groups

The bulk API allows you to create, update, and remove multiple users and groups in Webex. The number of Bulk operations in a single request is limited to 100.

Bulk deletion of Users is irreversible. Please test in a test org or sandbox before running the command in your production system.

bulk_request(org_id: str, fail_on_errors: int, operations: list[BulkOperation]) BulkResponse[source]

User bulk API

Authorization

OAuth token rendered by Identity Broker.

One of the following OAuth scopes is required:

  • identity:people_rw

  • Identity:SCIM

Usage:

  1. The input JSON must conform to the following schema: ‘urn:ietf:params:scim:api:messages:2.0:BulkRequest’.

  2. The request must be accompanied with a body in JSON format according to the standard SCIM schema definition. The maximum number of operations in a request is 100; an error is thrown if the limit is exceeded.

  3. failOnErrors parameter

    An integer specifies the number of errors that the service provider will accept before the operation is terminated and an error response is returned. It is OPTIONAL in a request. Maximum number of operations allowed to fail before the server stops processing the request. The value must be between 1 and 100.

  4. operations parameter

    Contains a list of bulk operations for POST/PATCH/DELETE operations. (REQUIRED)

    • operations.method

      The HTTP method of the current operation. Possible values are POST, PATCH or DELETE.

    • `operations.path

      The Resource’s relative path. If the method is POST the value must specify a Resource type endpoint; e.g., /Users or /Groups whereas all other method values must specify the path to a specific Resource; e.g., /Users/2819c223-7f76-453a-919d-413861904646.

    • operations.data

      The Resource data as it would appear for a single POST or PATCH Resource operation. It is REQUIRED in a request when method is POST and PATCH. Refer to corresponding wiki for SCIM 2.0 POST, PATCH and DELETE API.

    • operations.bulkId

      The transient identifier of a newly created resource, unique within a bulk request and created by the client. The bulkId serves as a surrogate resource id enabling clients to uniquely identify newly created resources in the response and cross-reference new resources in and across operations within a bulk request. It is REQUIRED when “method” is “POST”.

Parameters:
  • org_id (str) – Webex Identity assigned organization identifier for user’s organization.

  • fail_on_errors (int) – An integer specifying the maximum number of errors that the service provider will accept before the operation is terminated and an error response is returned.

  • operations (list[BulkOperation]) – Contains a list of bulk operations for POST/PATCH/DELETE operations.

Return type:

BulkResponse

Example

# bulk operations to create a bunch of users from a list of ScimUser instances
new_scim_users: list[ScimUser]
operations = [BulkOperation(method=BulkMethod.post, path='/Users',
                            bulk_id=str(uuid.uuid4()),
                            data=scim_user.create_update())
              for scim_user in new_scim_users]
bulk_response = self.api.scim.bulk.bulk_request(org_id=org_id, fail_on_errors=1,
                                                operations=operations)
base = 'identity/scim'