Updated on 2022-10-08 GMT+08:00

Creating an Application

Function

This API is used to create an application.

Constraints

A tenant cannot create multiple applications with the same app_name.

URI

POST /v2/apps

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Content type.

X-Auth-Token

No

String

User token. This parameter is mandatory when token authentication is used. It can be obtained by calling the IAM API that is used for obtaining a user token. The value of X-Subject-Token in the response header is the user token.

Authorization

No

String

Authentication information. This parameter is mandatory when AK/SK-based authentication is used.

X-Sdk-Date

No

String

Time when the request is sent. This parameter is mandatory when AK/SK-based authentication is used.

X-Project-Id

No

String

Project ID. This parameter is mandatory when AK/SK-based authentication is used.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

app_name

Yes

String

Application name. Only the UTF-8 format is supported.

Response Parameters

Status code: 201

Table 3 Response header parameters

Parameter

Type

Description

X-request-Id

String

Request ID for task tracing.

Table 4 Response body parameters

Parameter

Type

Description

app_id

String

Application ID.

Status code: 400

Table 5 Response header parameters

Parameter

Type

Description

X-request-Id

String

Request ID for task tracing.

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Description.

Status code: 500

Table 7 Response header parameters

Parameter

Type

Description

X-request-Id

String

Request ID for task tracing.

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Description.

Example Requests

POST https://rtc-api.myhuaweicloud.com/v2/apps

{
  "app_name" : "rtc"
}

Example Responses

Status code: 201

The application is created, and app_id is returned.

{
  "app_id" : "60d539ba00d861ef0802742ce404400c"
}

Status code: 400

The request cannot be understood by the server or parameters are incorrect.

{
  "error_code" : "RTC.00001003",
  "error_msg" : "InvalidParameterValue"
}

Status code: 500

Request failed due to server error.

{
  "error_code" : "RTC.00002xxx",
  "error_msg" : "InternalError"
}

Status Codes

Status Code

Description

201

The application is created, and app_id is returned.

400

The request cannot be understood by the server or parameters are incorrect.

500

Request failed due to server error.

Error Codes

See Error Codes.