CreateCommitStatus - Create commit status

Updated at:

Use OpenAPI to create or update commit statuses.

Applicable editions

Central edition, Region edition

Service Endpoints and Authorization Information

  • Obtain service endpoints: Replace {domain} in the API request syntax.
  • Obtain a personal access token.
  • Obtain the organizationId: Required only for the Central edition. Go to the Basic Information page in the Organization Management console to retrieve the organization ID.

Product

Resource

Required permissions

Code Management

Commit status

Read/write

Request Syntax

Central edition

POST https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/commits/{sha}/statuses

Region edition

POST https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/commits/{sha}/statuses

Request Headers

Parameter

Type

Required

Description

Example value

x-yunxiao-token

string

Yes

Personal access token.

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

Request Parameters

Parameter

Type

Location

Required

Description

Example value

organizationId

string

path

  • Yes: Central edition

  • No: Region edition

Organization ID.

60d54f3daccf2bbd6659f3ad

repositoryId

string

path

Yes

Repository ID or URL-encoded full path.

2813489 or 60de7a6852743a5162b5f957%2FDemoRepo

sha

string

path

Yes

Commit SHA.

6da8c14b5a9102998148b7ea35f96507d5304f74

-

object

body

No

context

string

body

No

Identifier that distinguishes writes from different systems. Displayed as a title on the UI page. Defaults to default, with a maximum length of 50 characters. Used in checkpoint settings and merge request filtering. Do not set this arbitrarily in production.

default-context

description

string

body

No

Description.

commit status description

state

string

body

Yes

Commit status. Valid values: error (abnormal), failure (failed), pending (running), and success (successful).

success

targetUrl

string

body

No

Redirect URL. The code platform provides the redirect UI. Set this to a third-party system URL.

http://example.com/example

Request Examples

Central edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489 or 60de7a6852743a5162b5f957/DemoRepo/commits/6da8c14b5a9102998148b7ea35f96507d5304f74/statuses' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "context": "default-context",
        "description": "commit status description",
        "state": "success",
        "targetUrl": "http://example.com/example"
    }'

Region edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/codeup/repositories/2813489or60de7a6852743a5162b5f957%2FDemoRepo/commits/6da8c14b5a9102998148b7ea35f96507d5304f74/statuses' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "context": "default-context",
        "description": "commit status description",
        "state": "success",
        "targetUrl": "http://example.com/example"
    }'

Response Parameters

Parameter

Type

Description

Example value

-

object

author

object

Author information.

avatarUrl

string

Profile picture URL.

https://example/example/w/100/h/100

id

string

User ID.

62c795xxxb468af8

name

string

User name.

codeup-name

type

string

Author type. Valid values: User and Bot (not yet available).

User

username

string

Login username.

codeup-username

context

string

Identifier that distinguishes different systems. Displayed as a title on the corresponding page. Maximum length: 50 characters. Do not set this arbitrarily in production.

default-context

createdAt

string

Creation time.

2024-10-05T15:30:45Z

description

string

Brief description. Maximum length: 3,000 characters.

commit status description

id

integer

Primary key ID with no business meaning.

1

sha

string

Commit SHA.

6da8c14b5a9102998148b7ea35f96507d5304f74

state

string

Commit status. Valid values: error (abnormal), failure (failed), pending (running), and success (successful).

success

targetUrl

string

External redirect URL. The code platform provides the redirect UI. Set this to a third-party system URL.

http://example.com/example

updatedAt

string

Last update time.

2024-10-05T15:30:45Z

Response Example

{
    "author": {
        "avatarUrl": "https://example/example/w/100/h/100",
        "id": "62c795xxxb468af8",
        "name": "codeup-name",
        "type": "User",
        "username": "codeup-username"
    },
    "context": "default-context",
    "createdAt": "2024-10-05T15:30:45Z",
    "description": "commit status description",
    "id": 1,
    "sha": "6da8c14b5a9102998148b7ea35f96507d5304f74",
    "state": "success",
    "targetUrl": "http://example.com/example",
    "updatedAt": "2024-10-05T15:30:45Z"
}

Error Codes

For more information, see Error Codes.