• Identity and Access Management

iam
  1. Help Center
  2. Identity and Access Management
  3. API Reference
  4. User Management
  5. Creating a User

Creating a User

Function Description

This interface is used to create a user under a domain.

URI

URI format

POST /v3/users

Request

  • Request header parameter description

    Parameter

    Mandatory

    Type

    Description

    Content-Type

    Yes

    String

    Fill application/json;charset=utf8 in this field.

    X-Auth-Token

    Yes

    String

    Authenticated token with the Security Administrator permission.

  • Request body parameter description

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    A username with 1 to 255 characters. It can contain any characters.

    domain_id

    No

    String

    ID of the domain where a user is located.

    enabled

    No

    Boolean

    Whether a user is enabled.

    The value can be true or false. true indicates the user is enabled and false indicates the user is not enabled. The default value is true.

    password

    No

    String

    Password of the user. The password must meet the following requirements:
    • Can contain 6 to 32 characters. The system default minimum password length is 6 characters, and you can change the minimum password length.
    • Must contain at least two of the following character types: uppercase letters, lowercase letters, digits, and special characters.
    • Cannot contain the user's mobile phone number or email address.
    • Must comply with the password policies under Account Settings.

    default_project_id

    No

    String

    Default project ID of a user.

  • Sample request
    1. Create the temporary file ${filename}.json based on the following template. ${filename} indicates the temporary file name, which is user-defined.
    {
        "user": {
            "default_project_id": "acf2ffabba974fae8f30378ffde2cfa6",
            "domain_id": "88b16b6440684467b8825d7d96e154d8",
            "enabled": true,
            "name": "jamesdoe",
            "password": "********"
        }
    }
    2. Run the following command under the directory of the ${filename}.json file.
    curl -i -k -H 'Accept:application/json' -H 'Content-Type:application/json;charset=utf8' -H "X-Auth-Token:$token" -X POST -d @${filename}.json https://172.30.48.86:31943/v3/users
    3. Run the following command under the directory of the ${filename}.json file to delete the ${filename}.json file.
    rm ${filename}.json

Response

  • Response body parameter description

    Parameter

    Mandatory

    Type

    Description

    user

    Yes

    JSONObject

    User object.

  • Description for the user format

    Parameter

    Mandatory

    Type

    Description

    enabled

    Yes

    Boolean

    Whether a user is enabled.

    The value can be true or false. true indicates the user is enabled and false indicates the user is not enabled. The default value is true.

    id

    Yes

    String

    User ID.

    domain_id

    Yes

    String

    ID of the domain where a user is located.

    name

    Yes

    String

    Username.

    links

    Yes

    JSONObject

    Resource links of a user.

    default_project_id

    No

    String

    Default project ID of a user.

    password_expires_at

    Yes

    String

    Coordinated Universal Time (UTC) that the password expires. null indicates that the password will not expire.

  • Sample response
    {
        "user": {
            "name": "jamesdoe",
            "links": {
                "self": "https://sample.domain.com/v3/users/614d1d2fb86940faab8f350bf1b9dbac"
            },
            "domain_id": "88b16b6440684467b8825d7d96e154d8",
            "enabled": true,
            "id": "614d1d2fb86940faab8f350bf1b9dbac",
            "default_project_id": "acf2ffabba974fae8f30378ffde2cfa6",
            "password_expires_at": null
        }
    }

Status Codes

Status Code

Description

201

The user is successfully created.

400

The server failed to process the request.

401

You must enter a username and password to access the requested page.

403

You are forbidden to access the requested page.

404

The server could not find the requested page.

405

You are not allowed to use the method specified in the request.

409

A resource conflict occurs.

413

The request entity is too large.

500

Failed to complete the request because of an internal service error.

503

Failed to complete the request because the service is unavailable.