CreateApplicationSource - Create application source

Updated at:

Applicable editions

Centralized edition, Regional edition

Service endpoint and authorization

  • Get service endpoint: Replace {domain} in the API request syntax.
  • Get personal access token.
  • Get the organization ID: Required for the Centralized edition only. Find your organization ID on the Basic Information page in the organization admin center.

Product

Resource

Required permissions

Application Delivery

Application

Read and write

Request syntax

Centralized edition

POST https://{domain}/oapi/v1/appstack/organizations/{organizationId}/apps/{appName}/sources

Regional edition

POST https://{domain}/oapi/v1/appstack/apps/{appName}/sources

Request header

Parameter

Type

Required

Description

Example

x-yunxiao-token

string

Yes

The personal access token for Alibaba Cloud DevOps.

pt-0fh3****0fbG_35af****0484

Request parameters

Parameter

Type

Location

Required

Description

Example

appName

string

path

Yes

The application name.

my-web-service

organizationId

string

path

  • Yes, for the Centralized edition

  • No, for the Regional edition

The organization ID.

ec766e63aee3437d9a51f334d6exe671

-

object

body

No

The request body.

connectionConfig

object

body

Yes

The Flow service connection information.

connectionId

string

body

Yes

The service connection ID. This is the integer id of the Flow service connection returned by the ListServiceConnections API.

183240

connectionType

string

body

Yes

The service connection type. The value must be FLOW.

FLOW

identifier

string

body

Yes

The unique identifier of the code repository.

myrepo

name

string

body

Yes

The code repository name.

6489a6ad391bxxxxyyy/Codeup-Demo

projectId

string

body

Yes

The project ID.

183240

repoContext

object

body

Yes

The code repository context.

defaultBranch

string

body

Yes

The default branch.

branch-xxx

repoType

string

body

Yes

The type of the code repository. Valid values: CODEUP (Codeup), CUSTOM_GITLAB (self-managed GitLab), and GIT (generic Git).

CODEUP

repoUrl

string

body

Yes

The code repository URL.

http://xxxxxxxxx.git

repoUrl

string

body

Yes

The code repository URL.

https://codeup.aliyun.com/6489a6ad391bxxxxyyy/Codeup-Demo.git

type

string

body

Yes

The type of the application source. The value must be CODE_REPO.

CODE_REPO

Request examples

Centralized edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/appstack/organizations/ec766e63aee3437d9a51f334d6exe671/apps/my-web-service/sources' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "connectionConfig": {
            "connectionId": "183240",
            "connectionType": "FLOW"
        },
        "identifier": "myrepo",
        "name": "6489a6ad391bxxxxyyy/Codeup-Demo",
        "projectId": "183240",
        "repoContext": {
            "defaultBranch": "branch-xxx",
            "repoType": "CODEUP",
            "repoUrl": "http://xxxxxxxxx.git"
        },
        "repoUrl": "https://codeup.aliyun.com/6489a6ad391bxxxxyyy/Codeup-Demo.git",
        "type": "CODE_REPO"
    }'

Regional edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/appstack/apps/my-web-service/sources' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "connectionConfig": {
            "connectionId": "183240",
            "connectionType": "FLOW"
        },
        "identifier": "myrepo",
        "name": "6489a6ad391bxxxxyyy/Codeup-Demo",
        "projectId": "183240",
        "repoContext": {
            "defaultBranch": "branch-xxx",
            "repoType": "CODEUP",
            "repoUrl": "http://xxxxxxxxx.git"
        },
        "repoUrl": "https://codeup.aliyun.com/6489a6ad391bxxxxyyy/Codeup-Demo.git",
        "type": "CODE_REPO"
    }'

Response parameters

Parameter

Type

Description

Example

-

object

The code repository source model.

appName

string

The unique name of the application.

my-web-service

connectionConfig

object

The Flow service connection information.

connectionId

string

The service connection ID. This is the integer id of the Flow service connection returned by the ListServiceConnections API.

183240

connectionType

string

The service connection type. The value must be FLOW.

FLOW

identifier

string

The unique identifier of the code repository, as defined by the code service provider.

my-web-service-repo

name

string

The name of the code repository source.

my-web-service-repo-git

repoContext

object

The code repository context.

defaultBranch

string

The default branch.

branch-xxx

repoType

string

The type of the code repository. Valid values: CODEUP (Codeup), CUSTOM_GITLAB (self-managed GitLab), and GIT (generic Git).

CODEUP

repoUrl

string

The code repository URL.

https://codeup.aliyun.com/6489a6ad391bxxxxyyy/Codeup-Demo.git

repoUrl

string

The code repository URL.

https://codeup.aliyun.com/bd9e3c6d-624f-4580-af7d-c5e26f1ed0f0/my-web-service-repo.git

sn

string

The unique serial number of the code repository source.

2e4bec5575244987a4f09ea4ca29e89f

type

string

The type of the application source. This value is always CODE_REPO.

CODE_REPO

Response example

{
    "appName": "my-web-service",
    "connectionConfig": {
        "connectionId": "183240",
        "connectionType": "FLOW"
    },
    "identifier": "my-web-service-repo",
    "name": "my-web-service-repo-git",
    "repoContext": {
        "defaultBranch": "branch-xxx",
        "repoType": "CODEUP",
        "repoUrl": "https://codeup.aliyun.com/6489a6ad391bxxxxyyy/Codeup-Demo.git"
    },
    "repoUrl": "https://codeup.aliyun.com/bd9e3c6d-624f-4580-af7d-c5e26f1ed0f0/my-web-service-repo.git",
    "sn": "2e4bec5575244987a4f09ea4ca29e89f",
    "type": "CODE_REPO"
}

Error codes

For a list of API-related error codes, see the Error Code Center.