Help Center/ ServiceStage/ API Reference/ Application Management V3 APIs/ Component/ Creating a Component Based on a Component Template
Updated on 2025-07-10 GMT+08:00

Creating a Component Based on a Component Template

Function

This API is used to create a component based on a component template.

URI

POST /v3/{project_id}/cas/components

Table 1 Path parameter

Parameter

Mandatory

Type

Description

project_id

Yes

String

Tenant's project ID. See Obtaining a Project ID.

Request

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format). Default value: application/json;charset=utf8.

X-Auth-Token

Yes

String

API calling can be authenticated using a token or AK/SK. If you use a token, this parameter is mandatory and must be set to the token. For details about how to obtain the token, see Authentication.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

environment_id

No

String

Environment ID. See Obtaining All Environments.

application_id

No

String

Application ID. See Obtaining All Applications.

template_source

No

Object

Source of the component template package. See Table 4.

input_values

No

Map<String, String>

Template package input information.

Table 4 template_source

Parameter

Mandatory

Type

Description

storage

Yes

String

Storage mode of the component template package.

  • devcloud: CodeArts release repository
  • obs
  • http: custom file address

url

Yes

String

Address of the component template package.

This parameter is valid only when the component template package storage mode is http.

http_username

No

String

Username.

This parameter is valid only when the component template package storage mode is http and the security authentication mode is username and password authentication.

http_password

No

String

Password.

This parameter is valid only when the component template package storage mode is http and the security authentication mode is username and password authentication.

http_headers

No

Array of objects

Request header. See Table 5.

This parameter is valid only when the component template package storage mode is http and the security authentication mode is custom header authentication.

Table 5 http_headers

Parameter

Mandatory

Type

Description

key

Yes

String

Request key.

value

Yes

String

Request value.

Response

Table 6 Response parameters

Parameter

Type

Description

component_id

Integer

Component ID.

job_id

Integer

Job ID.

Example Request

Create a container-deployed component based on the component template.

{
    "environment_id": "2393eecc-69bc-40a9-9b6c-996a9259618d",
    "application_id": "dda56ba8-5295-3d0d-b298-72cb1da3f515",
    "template_source": {
        "storage": "obs",
        "url": "obs://apitest/demo-app-package.zip",
        "http_username": null,
        "http_password": null,
        "http_headers": []
    },
    "input_values": {
        "config_name": "demo-group/application.yaml",
        "namespace": "default",
        "dep_name": "test-demo",
        "svc_port": 8080,
        "value": "World",
        "cce_resource": "ef1b6474-906c-11ef-a773-0255ac1000a3",
        "elb_resource": "053dcc46-d3fd-4796-bba1-b73650ec0906",
        "image": "swr.ap-southeast-1.myhuaweicloud.com/ss/demo-app:latest"
    }
}

Example Response

{
  "job_id": "string",
  "component_id": "string"
}

Status Code

Status Code

Description

200

OK

400

Bad Request

404

Not Found

500

Internal Server Error

Error Code

See ServiceStage Error Codes.