Updated on 2024-07-29 GMT+08:00

Creating a VPN User

Function

This API is used to create a VPN user on a specified VPN server.

Calling Method

For details, see Calling APIs.

URI

POST /v5/{project_id}/p2c-vpn-gateways/vpn-servers/{vpn_server_id}/users
Table 1 Parameter description

Parameter

Type

Mandatory

Description

project_id

String

Yes

Specifies a project ID. You can obtain the project ID by referring to Obtaining the Project ID.

vpn_server_id

String

Yes

Specifies the ID of a VPN server.

Table 2 Parameters in the request header

Parameter

Type

Mandatory

Description

X-Client-Token

String

No

  • Specifies the ID of an idempotent request.
  • The value is a UUID containing 36 characters.

Request

  • Request parameters
    Table 3 Request parameters

    Parameter

    Type

    Mandatory

    Description

    user

    CreateVpnUserRequestBodyContent object

    Yes

    Specifies the to-be-created VPN user object.

    Table 4 CreateVpnUserRequestBodyContent

    Parameter

    Type

    Mandatory

    Description

    name

    String

    Yes

    • Specifies a username.
    • The value is a string of 4 to 32 characters, which can contain letters, digits, periods (.), underscores (_), and hyphens (-)

    password

    String

    Yes

    • Specifies a password for the user.
    • Constraints:
      • The value contains 8 to 32 characters.
      • The value must contain at least two types of the following characters: uppercase letters, lowercase letters, digits, and the following special characters: `~!@#$%^&*()-_=+\|[{}];:'",<.>/? and spaces.
      • The password cannot be the username or the reverse of the username.

    description

    String

    No

    • Specifies user description.
    • The value is a string of 0 to 64 characters, which can contain letters, digits, and underscores (_).

    user_group_id

    String

    No

    • Specifies the ID of the user group to which the user belongs.
    • The value is a UUID containing 36 characters.
    • Example request
      POST https://{Endpoint}/v5/{project_id}/p2c-vpn-gateways/vpn-servers/{vpn_server_id}/users 
      
      {
        "user": {
          "name": "user001",
          "password": "******",
          "description": "UserDescription1",
          "user_group_id": "yWYnJt0R-Q0a7-R4QW-tFXX-QfundEqrR27W"
        }
      }

Response

  • Response parameters

    Returned status code 201: successful operation

    Table 5 Parameters in the response body

    Parameter

    Type

    Description

    user

    user object

    Specifies the VPN user object.

    request_id

    String

    Specifies a request ID.

    Table 6 user

    Parameter

    Type

    Description

    id

    String

    • Specifies the ID of a VPN user.
    • The value is a UUID containing 36 characters.
  • Example response
    {
      "user": {
        "id": "41ad472e-d3e4-482b-8f00-7b2c1bfc4b7d"
      },
      "request_id": "b19ba5a0be8f7b7f664b14596f8f35db"
    }

Status Codes

For details, see Status Codes.