Create and Join User

Create a user and assign an OU to the user without logging in to Application Portal.

Operation Permissions

In Application Portal, the application must be granted the “Create or delete user accounts in the OU” permission.

Request Format

POST https://{apigw-address}/app-portal-service/v2.2/user/createAndJoin

Request Parameters (Body)

Name

Mandatory/Optional

Data Type

Description

name

Mandatory

String

The user name.

domain

Optional

String

The registered domain name in Application Portal that corresponds to the domain account.

email

Mandatory

String

The user’s email address.

organizationId

Mandatory

String

The ID of the OU to assign to the user. How to get organizationId>>

locale

Optional

String

The language code. If unspecified, it is set to Chinese by default.

  • en_US for English

  • zh_CN for Chinese

  • es_ES for Spanish

  • ja_JP for Japanese

nickName

Optional

String

The nickname of the user.

Response Parameters

Name

Data Type

Description

data

Boolean

true indicates that creation of the user was successful, false indicates that creation of the user failed.

Error Codes

Code

Description

31400

Errors such as incorrect parameters, empty parameters, character limits exceeded, and so on.

31403

The application has not been granted the “Create or delete user accounts in the OU” permission.

31404

Errors such as organization not found, domain not found, and so on.

Samples

Request Sample

url: https://{apigw-address}/app-portal-service/v2.2/user/createAndJoin

method: POST

requestBody:
{"name":"yourName", "domain":"yourDomain", "email":"yourEmail", "organizationId":"yourOrgId", "locale":"zh_CN","nickName":"yourNickname"}

Return Sample

{
  "code": 0,
  "message": "OK",
  "data": true
}

Java SDK Sample

public class AppPortalSdkTest{
    @Test
    public void createAndJoinUser() {
            UserCreateAndJoinRequest userCreateAndJoinRequest = new UserCreateAndJoinRequest("your_user_name", "your_domain", "your_email", "your_org_id", "zh_CN", "your_nickname");
            UserCreateAndJoinResponse userCreateAndJoinResponse = Poseidon.config(PConfig.init().appKey("your_access_key").appSecret("your_secret_key").debug())
                    .url("https://{apigw-address}").getResponse(userCreateAndJoinRequest, UserCreateAndJoinResponse.class);

            System.out.println("List organization res: " + JSON.toJSONString(userCreateAndJoinResponse));

            assertNotNull("Response should not be null", userCreateAndJoinResponse);
            assertNotNull("Response data should not be null", userCreateAndJoinResponse.data);

    }
}