Skip to content

/AWS1/IF_WKR=>BATCHCREATEUSER()

About BatchCreateUser

Creates multiple users in a specified Wickr network. This operation allows you to provision multiple user accounts simultaneously, optionally specifying security groups, and validation requirements for each user.

codeValidation, inviteCode, and inviteCodeTtl are restricted to networks under preview only.

Method Signature

METHODS /AWS1/IF_WKR~BATCHCREATEUSER
  IMPORTING
    !IV_NETWORKID TYPE /AWS1/WKRNETWORKID OPTIONAL
    !IT_USERS TYPE /AWS1/CL_WKRBTCCREUSERREQITEM=>TT_BATCHCREATEUSERREQUESTITEMS OPTIONAL
    !IV_CLIENTTOKEN TYPE /AWS1/WKRCLIENTTOKEN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_wkrbatchcreateuserrsp
  RAISING
    /AWS1/CX_WKRBADREQUESTERROR
    /AWS1/CX_WKRFORBIDDENERROR
    /AWS1/CX_WKRINTSERVERERROR
    /AWS1/CX_WKRRATELIMITERROR
    /AWS1/CX_WKRRESNOTFOUNDERROR
    /AWS1/CX_WKRUNAUTHORIZEDERROR
    /AWS1/CX_WKRVALIDATIONERROR
    /AWS1/CX_WKRCLIENTEXC
    /AWS1/CX_WKRSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_networkid TYPE /AWS1/WKRNETWORKID /AWS1/WKRNETWORKID

The ID of the Wickr network where users will be created.

it_users TYPE /AWS1/CL_WKRBTCCREUSERREQITEM=>TT_BATCHCREATEUSERREQUESTITEMS TT_BATCHCREATEUSERREQUESTITEMS

A list of user objects containing the details for each user to be created, including username, name, security groups, and optional invite codes. Maximum 50 users per batch request.

Optional arguments:

iv_clienttoken TYPE /AWS1/WKRCLIENTTOKEN /AWS1/WKRCLIENTTOKEN

A unique identifier for this request to ensure idempotency. If you retry a request with the same client token, the service will return the same response without creating duplicate users.

RETURNING

oo_output TYPE REF TO /aws1/cl_wkrbatchcreateuserrsp /AWS1/CL_WKRBATCHCREATEUSERRSP

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->batchcreateuser(
  it_users = VALUE /aws1/cl_wkrbtccreuserreqitem=>tt_batchcreateuserrequestitems(
    (
      new /aws1/cl_wkrbtccreuserreqitem(
        it_securitygroupids = VALUE /aws1/cl_wkrsecgroupidlist_w=>tt_securitygroupidlist(
          ( new /aws1/cl_wkrsecgroupidlist_w( |string| ) )
        )
        iv_codevalidation = ABAP_TRUE
        iv_firstname = |string|
        iv_invitecode = |string|
        iv_invitecodettl = 123
        iv_lastname = |string|
        iv_username = |string|
      )
    )
  )
  iv_clienttoken = |string|
  iv_networkid = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_genericstring = lo_result->get_message( ).
  LOOP AT lo_result->get_successful( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_userid = lo_row_1->get_userid( ).
      lv_sensitivestring = lo_row_1->get_firstname( ).
      lv_sensitivestring = lo_row_1->get_lastname( ).
      lv_genericstring = lo_row_1->get_username( ).
      LOOP AT lo_row_1->get_securitygroups( ) into lo_row_2.
        lo_row_3 = lo_row_2.
        IF lo_row_3 IS NOT INITIAL.
          lv_securitygroupid = lo_row_3->get_value( ).
        ENDIF.
      ENDLOOP.
      lv_boolean = lo_row_1->get_isadmin( ).
      lv_boolean = lo_row_1->get_suspended( ).
      lv_integer = lo_row_1->get_status( ).
      lv_boolean = lo_row_1->get_otpenabled( ).
      lv_genericstring = lo_row_1->get_scimid( ).
      lv_genericstring = lo_row_1->get_type( ).
      lv_genericstring = lo_row_1->get_cell( ).
      lv_genericstring = lo_row_1->get_countrycode( ).
      lv_integer = lo_row_1->get_challengefailures( ).
      lv_boolean = lo_row_1->get_isinviteexpired( ).
      lv_boolean = lo_row_1->get_isuser( ).
      lv_genericstring = lo_row_1->get_invitecode( ).
      lv_boolean = lo_row_1->get_codevalidation( ).
      lv_genericstring = lo_row_1->get_uname( ).
    ENDIF.
  ENDLOOP.
  LOOP AT lo_result->get_failed( ) into lo_row_4.
    lo_row_5 = lo_row_4.
    IF lo_row_5 IS NOT INITIAL.
      lv_genericstring = lo_row_5->get_field( ).
      lv_genericstring = lo_row_5->get_reason( ).
      lv_userid = lo_row_5->get_userid( ).
    ENDIF.
  ENDLOOP.
ENDIF.

Create multiple users

Create multiple users

DATA(lo_result) = lo_client->batchcreateuser(
  it_users = VALUE /aws1/cl_wkrbtccreuserreqitem=>tt_batchcreateuserrequestitems(
    (
      new /aws1/cl_wkrbtccreuserreqitem(
        it_securitygroupids = VALUE /aws1/cl_wkrsecgroupidlist_w=>tt_securitygroupidlist(
          ( new /aws1/cl_wkrsecgroupidlist_w( |BCTY8Qhe| ) )
        )
        iv_codevalidation = ABAP_TRUE
        iv_firstname = |John|
        iv_invitecode = |INVITE123|
        iv_invitecodettl = 7
        iv_lastname = |Doe|
        iv_username = |john.doe@example.com|
      )
    )
    (
      new /aws1/cl_wkrbtccreuserreqitem(
        it_securitygroupids = VALUE /aws1/cl_wkrsecgroupidlist_w=>tt_securitygroupidlist(
          ( new /aws1/cl_wkrsecgroupidlist_w( |BCTY8Qhe| ) )
        )
        iv_firstname = |Jane|
        iv_lastname = |Smith|
        iv_username = |jane.smith@example.com|
      )
    )
  )
  iv_clienttoken = |550e8400-e29b-41d4-a716-446655440000|
  iv_networkid = |12345678|
).

Partial failure - duplicate user

Partial failure - duplicate user

DATA(lo_result) = lo_client->batchcreateuser(
  it_users = VALUE /aws1/cl_wkrbtccreuserreqitem=>tt_batchcreateuserrequestitems(
    (
      new /aws1/cl_wkrbtccreuserreqitem(
        it_securitygroupids = VALUE /aws1/cl_wkrsecgroupidlist_w=>tt_securitygroupidlist(
          ( new /aws1/cl_wkrsecgroupidlist_w( |BCTY8Qhe| ) )
        )
        iv_firstname = |Alice|
        iv_lastname = |Johnson|
        iv_username = |alice.johnson@example.com|
      )
    )
    (
      new /aws1/cl_wkrbtccreuserreqitem(
        it_securitygroupids = VALUE /aws1/cl_wkrsecgroupidlist_w=>tt_securitygroupidlist(
          ( new /aws1/cl_wkrsecgroupidlist_w( |BCTY8Qhe| ) )
        )
        iv_firstname = |Bob|
        iv_lastname = |Wilson|
        iv_username = |existing.user@example.com|
      )
    )
  )
  iv_networkid = |12345678|
).