Updated on 2026-04-10 GMT+08:00

Creating a Pipeline Environment

Function

This API is used to modify the environment of a pipeline.

URI

POST /cpepipeline/v2/environments

Request

Table 1 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 Obtaining a User Token Through Password Authentication.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Environment name.

displayName

Yes

String

Environment display name. If this parameter is left blank, the value is the same as the value of name.

description

No

String

Environment description.

tasks

Yes

Array of objects

Environment task.

Table 3 tasks

Parameter

Mandatory

Type

Description

name

Yes

String

Task name.

orderIndex

Yes

Integer

Task execution order.

taskTypeId

Yes

Object

Task type. For details, see Table 4.

input

Yes

Object

Task input. For details, see Table 5.

Table 4 taskTypeId

Parameter

Mandatory

Type

Description

category

Yes

String

Task directory.

owner

Yes

String

Task owner.

provider

Yes

String

Task provider.

Table 5 input

Parameter

Mandatory

Type

Description

instanceId

No

String

Component instance ID.

appName

No

String

Component name.

modifiedPath

No

String

Product path.

version

No

String

Modified version.

Response

Table 6 Response parameters

Parameter

Type

Description

id

String

Environment ID.

name

String

Environment name.

creator

String

Environment creator.

revisor

String

Environment saver.

created_at

Integer

Creation time.

updated_at

Integer

Update time.

status

Integer

Environment status.

project_id

String

Project ID.

detail

String

Environment details. For details, see Table 7.

Table 7 detail

Parameter

Type

Description

name

String

Environment name.

tasks

String

Environment task. For details, see Table 8.

Table 8 tasks

Parameter

Type

Description

id

Integer

Task ID.

name

String

Task name.

displayName

String

Display name of a task.

input

Object

Task input parameter. For details, see Table 10.

status

Integer

Task status.

errorDetails

String

Task error information.

stageName

String

Stage type.

taskTypeId

Object

Task type. For details, see Table 4.

Table 9 taskTypeId

Parameter

Type

Description

category

String

Task directory.

owner

String

Task owner.

provider

String

Task provider.

type

String

Task type.

Table 10 input

Parameter

Type

Description

instanceId

String

Component instance ID.

appName

String

Component name.

modifiedPath

String

Product path.

version

String

Modified version.

Example Request

{
    "id": "805f7ec2-7c05-417b-bc3e-5f6035edb673",
    "name": "Environment-894g",
    "creator": "servicestage_iam5",
    "revisor": "servicestage_iam5",
    "created_at": 1753165301070,
    "updated_at": 1753165301070,
    "status": 0,
    "project_id": "59336be373624a998b2527fdb9913266",
    "detail": {
        "name": "Environment-894g",
        "tasks": [
            {
                "id": 0,
                "name": "Deploy",
                "display_name": "Deploy",
                "task_type_id": {
                    "category": "Deploy",
                    "owner": "System",
                    "provider": "ENV-CAS",
                    "type": null
                },
                "input": {
                    "instanceId": "20acd377-0659-478c-b563-c2585166278e",
                    "appName": "ghy-test-0707-1-2",
                    "modifiedPath": "{\"ghy-test-0707-1-2\":\"${Artifacts_ghy-test-comp-0626-3-62e353_Output_release@PublishBuildImage}\"}",
                    "version": "1.0.0"
                },
                "output": {},
                "status": null,
                "order_index": 0,
                "skipped": false,
                "group_index": null,
                "delay_time": 0,
                "error_details": null,
                "stage_name": null
            }
        ]
    }
}

Example Response

{
    "id": "805f7ec2-7c05-417b-bc3e-5f6035edb673",
    "name": "Environment-894g",
    "creator": "servicestage_iam5",
    "revisor": "servicestage_iam5",
    "created_at": 1753165301070,
    "updated_at": 1753165301070,
    "status": 0,
    "project_id": "59336be373624a998b2527fdb9913266",
    "detail": {
        "name": "Environment-894g",
        "tasks": [
            {
                "id": 0,
                "name": "Deploy",
                "displayName": "Deploy",
                "taskTypeId": {
                    "category": "Deploy",
                    "owner": "System",
                    "provider": "ENV-CAS",
                    "type": null
                },
                "input": {
                    "instanceId": "20acd377-0659-478c-b563-c2585166278e",
                    "appName": "ghy-test-0707-1-2",
                    "modifiedPath": "{\"ghy-test-0707-1-2\":\"${Artifacts_ghy-test-comp-0626-3-62e353_Output_release@PublishBuildImage}\"}",
                    "version": "1.0.0"
                },
                "output": {},
                "status": null,
                "skipped": false
            }
        ]
    }
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

404

Not Found

500

Internal Server Error

Error Codes

See ServiceStage Error Codes.