UpdateWebHook - Update Webhook

Updated at:

Updates an existing webhook for a code repository.

Applicable editions

Central edition, Region edition

Endpoints and Authorization Information

  • Obtain endpoints: Replace `{domain}` in the API request syntax.
  • Obtain a personal access token.
  • Obtain the organizationId: Required only for the Central edition. You can obtain the organization ID from the **Basic Information** page in the **Tenant Management backend**.

Product

Resource

Required Permissions

Code Management

Webhook

Read/Write

Request Syntax

Central edition

PUT https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/webhooks/{hookId}

Region edition

PUT https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/webhooks/{hookId}

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-specific version

Organization ID.

60d54f3daccf2bbd6659f3ad

repositoryId

string

path

Yes

Repository ID or URL-encoded full path.

2813489 or 60de7a6852743a5162b5f957%2FDemoRepo

hookId

integer

path

Yes

Webhook primary key ID.

1

-

object

body

No

description

string

body

No

Webhook description.

Description content

enableSslVerification

boolean

body

No

Whether to enable SSL verification.

false

mergeRequestsEvents

boolean

body

No

Merge request events.

true

noteEvents

boolean

body

No

Note events.

true

pushEvents

boolean

body

No

Push events.

true

tagPushEvents

boolean

body

No

Tag push events.

true

token

string

body

No

User-defined token for identity verification.

xxx

url

string

body

Yes

Webhook URL, which generally does not exceed 1024 characters.

http://example/example

Request Examples

Central edition

curl -X 'PUT' \
  'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/webhooks/1' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "description": "Description content",
        "enableSslVerification": false,
        "mergeRequestsEvents": true,
        "noteEvents": true,
        "pushEvents": true,
        "tagPushEvents": true,
        "token": "xxx",
        "url": "http://example/example"
    }'

Region edition

curl -X 'PUT' \
  'https://{domain}/oapi/v1/codeup/repositories/{repository_id_or_path}/webhooks/1' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "description": "Sample description",
        "enableSslVerification": false,
        "mergeRequestsEvents": true,
        "noteEvents": true,
        "pushEvents": true,
        "tagPushEvents": true,
        "token": "xxx",
        "url": "http://example/example"
    }'

Response Parameters

Parameter

Type

Description

Example Value

-

object

createdAt

string

Creation time.

2024-10-05T15:30:45Z

description

string

Webhook description.

Description content

enableSSLVerification

boolean

Whether to enable SSL verification.

false

id

integer

Webhook primary key ID.

1

mergeRequestEvents

boolean

Merge request events.

true

noteEvents

boolean

Note events.

true

pushEvents

boolean

Code push events.

true

repositoryId

integer

Repository ID.

1

tagPushEvents

boolean

Tag push events.

true

token

string

User-defined token for identity verification.

xxx

updatedAt

string

Update time.

2024-10-05T15:30:45Z

url

string

Webhook URL.

http://example/example

Response Example

{
    "createdAt": "2024-10-05T15:30:45Z",
    "description": "Description content",
    "enableSSLVerification": false,
    "id": 1,
    "mergeRequestEvents": true,
    "noteEvents": true,
    "pushEvents": true,
    "repositoryId": 1,
    "tagPushEvents": true,
    "token": "xxx",
    "updatedAt": "2024-10-05T15:30:45Z",
    "url": "http://example/example"
}

Error Codes

For more information about error codes, see Error Code Center.