UpdateRepository - Updates a code repository

Updated at:

Applicable editions

Central edition, Region edition

Endpoints and authorization information

  • Get a service endpoint: replace the {domain} placeholder in the request syntax.
  • Get a personal access token.
  • Get an organization ID: Required only for the Central edition. Go to the Organization Management console and get the organization ID from the Basic Information page.

Product

Resource

Required permission

Codeup

Code repository

Read/Write

Request syntax

Central edition

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

Region edition

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

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

The organization ID.

60d54f3daccf2bbd6659f3ad

repositoryId

string

path

Yes

The repository ID or the URL-encoded full path.

2813489 or 60de7a6852743a5162b5f957%2FDemoRepo

-

object

body

No

default_branch

string

body

No

The default branch.

master

description

string

body

No

The repository description. A maximum of 65535 characters.

Description content

name

string

body

No

The repository name.

demo-repo

repositoryTags

array[string]

body

No

The list of repository tag names.

["tag1", "tag2"]

visibility

string

body

No

The visibility. private: private. internal: public within the organization. Valid values: [private internal].

private

Request examples

Central edition

curl -X 'PUT' \
  'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "default_branch": "master",
        "description": "Description content",
        "name": "demo-repo",
        "repositoryTags": ["tag1", "tag2"],
        "visibility": "private"
    }'

Region edition

curl -X 'PUT' \
  'https://{domain}/oapi/v1/codeup/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "default_branch": "master",
        "description": "Description content",
        "name": "demo-repo",
        "repositoryTags": ["tag1", "tag2"],
        "visibility": "private"
    }'

Response parameters

Parameter

Type

Description

Example value

-

object

The response of the UpdateRepository (PUT) operation. The fields are largely the same as those in the GET repository details response, except that the top-level accessLevel is a numeric permission value rather than the enum string returned by GET.

accessLevel

integer

The permission level of the current user on the repository. Valid values: [20 30 40].

40

adminSettingLanguage

string

The primary programming language of the repository.

Java

allowPush

boolean

Indicates whether pushes are allowed.

true

archived

boolean

Indicates whether the repository is archived.

false

avatarUrl

string

The repository avatar URL.

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

cloneDownloadControlGray

boolean

The organization-level gray release switch for clone/download control.

false

createdAt

string

The creation time.

2024-10-05T15:30:45Z

creatorId

integer

The user ID of the creator.

No actual business meaning

creatorUid

string

The repository creator (Yunxiao user ID).

5f8b3b3b3b3b3b3b3b3b3b3b

defaultBranch

string

The default branch of the repository.

master

demoProject

boolean

Indicates whether the repository is a demo repository.

false

description

string

The repository description.

Repository description

enableCloneDownloadControl

boolean

Indicates whether code clone/download control is enabled.

false

forkCount

integer

The number of forks.

1

httpUrlToRepo

string

The HTTP URL.

https://example.com/example_org/example.git

id

integer

The repository ID.

1

lastActivityAt

string

The last activity time.

2024-10-05T15:30:45Z

name

string

The repository name.

demo-repo

nameWithNamespace

string

The full name of the repository (including the full group name).

60de7a6852743a5162b5f957 / DemoRepo

namespace

object

avatar

string

The avatar URL.

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

createdAt

string

The creation time.

2024-10-05T15:30:45Z

description

string

The description.

Description content

id

integer

The ID.

1

name

string

The name.

demo-namespace

ownerId

integer

The owner ID.

No actual business meaning

path

string

The path.

demo-namespace

updatedAt

string

The update time.

2024-10-05T15:30:45Z

visibility

string

The visibility. private: private. internal: public within the organization. Valid values: [private internal].

private

openCloneDownloadControl

boolean

Indicates whether clone/download control is enabled.

false

owner

object

avatarUrl

string

The user avatar URL.

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

email

string

The user email.

username@example.com

id

integer

The primary key ID with no business meaning.

1

name

string

The user name.

codeup-name

state

string

The user status. Valid values: {active, blocked}.

active

userId

string

The Yunxiao user ID.

62c795xxxb468af8

username

string

The user logon name.

codeup-username

webUrl

string

The web access URL.

xxx

path

string

The repository path.

demo-repo

pathWithNamespace

string

The full path of the repository (including the full group path).

60de7a6852743a5162b5f957/DemoRepo

permissions

object

The permission summary.

groupAccess

object

accessLevel

integer

The group permission. Valid values: {20-Viewer, 30-Developer, 40-Admin}.

30

notificationLevel

integer

Reserved information.

xxx

projectAccess

object

accessLevel

integer

The repository permission. Valid values: {20-Viewer, 30-Developer, 40-Admin}.

30

notificationLevel

integer

Reserved information.

xxx

projectType

integer

The repository type. Default value: empty or 0.

0

repositoryTags

array

The list of repository tags.

-

object

The repository tag.

tagColor

string

The tag color.

#C4C6CF

tagName

string

The tag name.

tag1

sshUrlToRepo

string

The SSH clone URL of the repository.

git@example:example_org/example.git

starCount

integer

The number of stars.

1

updatedAt

string

The update time.

2024-10-05T15:30:45Z

visibility

string

The visibility. private: private. internal: public within the organization. Valid values: [private internal].

private

webUrl

string

The URL for web access.

https://example.com/example/example_demo

Response example

{
    "accessLevel": 40,
    "adminSettingLanguage": "Java",
    "allowPush": true,
    "archived": false,
    "avatarUrl": "https://example/example/w/100/h/100",
    "cloneDownloadControlGray": false,
    "createdAt": "2024-10-05T15:30:45Z",
    "creatorId": No actual business meaning,
    "creatorUid": "5f8b3b3b3b3b3b3b3b3b3b3b",
    "defaultBranch": "master",
    "demoProject": false,
    "description": "Repository description",
    "enableCloneDownloadControl": false,
    "forkCount": 1,
    "httpUrlToRepo": "https://example.com/example_org/example.git",
    "id": 1,
    "lastActivityAt": "2024-10-05T15:30:45Z",
    "name": "demo-repo",
    "nameWithNamespace": "60de7a6852743a5162b5f957 / DemoRepo",
    "namespace": {
        "avatar": "https://example/example/w/100/h/100",
        "createdAt": "2024-10-05T15:30:45Z",
        "description": "Description content",
        "id": 1,
        "name": "demo-namespace",
        "ownerId": No actual business meaning,
        "path": "demo-namespace",
        "updatedAt": "2024-10-05T15:30:45Z",
        "visibility": "private"
    },
    "openCloneDownloadControl": false,
    "owner": {
        "avatarUrl": "https://example/example/w/100/h/100",
        "email": "username@example.com",
        "id": 1,
        "name": "codeup-name",
        "state": "active",
        "userId": "62c795xxxb468af8",
        "username": "codeup-username",
        "webUrl": "xxx"
    },
    "path": "demo-repo",
    "pathWithNamespace": "60de7a6852743a5162b5f957/DemoRepo",
    "permissions": {
        "groupAccess": {
            "accessLevel": 30,
            "notificationLevel": xxx
        },
        "projectAccess": {
            "accessLevel": 30,
            "notificationLevel": xxx
        }
    },
    "projectType": 0,
    "repositoryTags": [
        {
            "tagColor": "#C4C6CF",
            "tagName": "tag1"
        }
    ],
    "sshUrlToRepo": "git@example:example_org/example.git",
    "starCount": 1,
    "updatedAt": "2024-10-05T15:30:45Z",
    "visibility": "private",
    "webUrl": "https://example.com/example/example_demo"
}

Error codes

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