CreatePipeline - Create a pipeline
Create a pipeline using OpenAPI.
|
Applicable editions |
Central edition, Region edition |
Service endpoints and authorization information
-
Get the service endpoint: Replace {domain} in the API request syntax.
-
Get the organizationId: Required only for the Central edition. Go to the Organization Management console, then go to the Basic Information page to obtain the organization ID.
|
Product |
Resource |
Required permission |
|
Pipeline |
Pipeline |
Read and write |
Request syntax
Central edition
POST https://{domain}/oapi/v1/flow/organizations/{organizationId}/pipelines
Region edition
POST https://{domain}/oapi/v1/flow/pipelines
Request headers
|
Parameter |
Type |
Required |
Description |
Example value |
|
x-yunxiao-token |
string |
Yes |
Your personal access token. |
pt-0fh3****0fbG_35af****0484 |
Request parameters
|
Parameter |
Type |
Location |
Required |
Description |
Example value |
|
organizationId |
string |
path |
|
Your organization ID. |
5ebbc0228123212b59xxxxx |
| - |
object |
body |
No |
||
|
content |
string |
body |
Yes |
Your pipeline YAML definition. For help writing this, see the YAML pipeline documentation. |
stages: |
|
name |
string |
body |
Yes |
The pipeline name. Maximum 60 characters. |
Test pipeline |
Request examples
Central edition
curl -X 'POST' \
'https://{domain}/oapi/v1/flow/organizations/5ebbc0228123212b59xxxxx/pipelines' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
--data '
{
"content": "stages:
command_stage:
name: \"Run command\"
jobs:
command_job:
name: \"Run command\"
runsOn:
group: public/cn-beijing
container: build-steps-public-registry.cn-beijing.cr.aliyuncs.com/build-steps/alinux3:latest
steps:
command_step:
name: \"Run command\"
step: \"Command\"
with:
run: \"echo hello world\"",
"name": "Test pipeline"
}'
Region edition
curl -X 'POST' \
'https://{domain}/oapi/v1/flow/pipelines' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
--data '
{
"content": "stages:
command_stage:
name: \"Run command\"
jobs:
command_job:
name: \"Run command\"
runsOn:
group: public/cn-beijing
container: build-steps-public-registry.cn-beijing.cr.aliyuncs.com/build-steps/alinux3:latest
steps:
command_step:
name: \"Run command\"
step: \"Command\"
with:
run: \"echo hello world\"",
"name": "Test pipeline"
}'
Response parameters
|
Parameter |
Type |
Description |
Example value |
|
- |
integer |
Your pipeline ID. |
1 |
Response example
1
Error codes
For a list of API error codes, see Error Code Center.