Updated on 2025-10-24 GMT+08:00

Creating a Component

Function

This API is used to create a component after you create an application or sub-application.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    coc:application:create

    Write

    application *

    -

    -

    -

URI

POST /v1/components

Request Parameters

Table 1 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Definition:

Component name.

Constraints:

The value can contain only letters, digits, hyphens (-), and underscores (_).

Value range:

The value is a string. It can contain 3 to 50 characters.

Default value:

N/A

application_id

Yes

String

Definition:

Application ID.

Constraints:

N/A

Value range:

ID of the application for the component corresponding to the group. There is a clear hierarchy between them.

Default value:

N/A

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

data

String

UUID allocated by CloudCMDB.

Example Requests

This API is used to create a component.

POST https://{Endpoint}/v1/components

{
  "name" : "Test component",
  "application_id" : "67e3b885ef614c77c8b76f4c"
}

Example Responses

Status code: 200

A component is created.

{
  "data" : {
    "id" : "685d1e8e02a50263fb2c259c",
    "name" : "Test component",
    "code" : null,
    "domainId" : "dc2d76541f754d68a4c8d150262d92c2",
    "applicationId" : "67e3b885ef614c77c8b76f4c",
    "path" : "string",
    "createTime" : "string",
    "updateTime" : "string"
  }
}

Status Codes

Status Code

Description

200

A component is created.

Error Codes

See Error Codes.