DeleteProtectedBranch - Remove Protected Branch

Updated at:

Deletes a protected branch rule from a 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 organizationId: Required for Central edition only. Go to the Basic Information page of the Organization Management console to obtain the organization ID.

Product

Resource

Required Permissions

Code Management

Protected Branch

Read/Write

Request Syntax

Central edition

DELETE https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/protectedBranches/{id}

Region edition

DELETE https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/protectedBranches/{id}

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

integer

path

Yes

Repository ID or URL-encoded full path.

2813489 or 60de7a6852743a5162b5f957%2FDemoRepo

id

integer

path

Yes

Primary key ID of the protected branch rule.

1

Request Examples

Central edition

curl -X 'DELETE' \
  'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/protectedBranches/1' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Region edition

curl -X 'DELETE' \
  'https://{domain}/oapi/v1/codeup/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/protectedBranches/1' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Response Parameters

Parameter

Type

Description

Example Value

-

object

result

boolean

Whether the operation succeeded.

true

Response Example

{
    "result": true
}

Error Codes

For API error codes, see Error Code Center.