TransferRepository - Transfer a repository

Updated at:

Transfers a repository to a target group by using OpenAPI. The repositoryId and groupId parameters accept either a numeric string (the resource primary key) or a path_with_namespace full path string.

Applicable editions

Central edition, Region edition

Endpoints and authorization

  • Get the endpoint to replace {domain} in the request syntax.

  • Get a personal access token.

  • Get the organization ID. This parameter is required only for the Central edition. Go to the Basic Information page in the Organization Management console to obtain the organization ID.

Product

Resource

Required permission

Codeup

Code repository

Read/Write

Request syntax

Central edition

POST https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/transfer

Region edition

POST https://{domain}/oapi/v1/codeup/repositories/transfer

Request header

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

The organization ID.

60d54f3daccf2bbd6659f3ad

-

object

body

No

groupId

string

body

Yes

The ID of the target group (a numeric string) or its path_with_namespace full path.

60de7a6852743a5162b5f957/target-group

repositoryId

string

body

Yes

The ID of the repository (a numeric string) or its path_with_namespace full path.

60de7a6852743a5162b5f957/DemoRepo

Request examples

Central edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/transfer' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "groupId": "60de7a6852743a5162b5f957/target-group",
        "repositoryId": "60de7a6852743a5162b5f957/DemoRepo"
    }'

Region edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/codeup/repositories/transfer' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "groupId": "60de7a6852743a5162b5f957/target-group",
        "repositoryId": "60de7a6852743a5162b5f957/DemoRepo"
    }'

Response parameters

Parameter

Type

Description

Example value

-

object

accessLevel

integer

The access level of the current user for this repository. Valid values: 20, 30, and 40.

40

archived

boolean

Whether the repository is archived.

false

avatarUrl

string

The URL of the avatar.

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

createdAt

string

The creation time.

2024-10-05T15:30:45Z

creatorId

integer

The creator of the repository.

1

creatorUid

string

The creator of the repository (Yunxiao user ID).

5f8b3b3b3b3b3b3b3b3b3b3b

demoProject

boolean

Whether the repository is a demo repository.

false

description

string

The description of the repository.

demo repo

encrypted

boolean

Whether the repository is encrypted.

false

id

integer

The ID of the repository.

2813489

lastActivityAt

string

The last activity time.

2024-10-05T15:30:45Z

name

string

The name of the repository.

demo-repo

nameWithNamespace

string

The full name of the repository, including the full group name.

60de7a6852743a5162b5f957 / DemoRepo

namespaceId

integer

The ID of the parent path.

2813489

path

string

The path of the repository.

demo-repo

pathWithNamespace

string

The full path of the repository, including the full group path.

60de7a6852743a5162b5f957/DemoRepo

repositorySize

string

The size of the repository, in MB.

1

repositoryTags

array

The list of repository tags.

-

object

The repository tag.

tagColor

string

The color of the tag.

#C4C6CF

tagName

string

The name of the tag.

Tag 1

starCount

integer

The number of times the repository is starred.

1

starred

boolean

Whether the current user has starred the repository.

false

updatedAt

string

The last update time.

2024-10-05T15:30:45Z

visibility

string

The visibility of the repository. Valid values: private (visible only within the repository) and internal (public within the organization).

private

webUrl

string

The URL for web access.

http://example.com/org-demo/example-repo

Response example

{
    "accessLevel": 40,
    "archived": false,
    "avatarUrl": "https://example/example/w/100/h/100",
    "createdAt": "2024-10-05T15:30:45Z",
    "creatorId": 1,
    "creatorUid": "5f8b3b3b3b3b3b3b3b3b3b3b",
    "demoProject": false,
    "description": "demo repo",
    "encrypted": false,
    "id": 2813489,
    "lastActivityAt": "2024-10-05T15:30:45Z",
    "name": "demo-repo",
    "nameWithNamespace": "60de7a6852743a5162b5f957 / DemoRepo",
    "namespaceId": 2813489,
    "path": "demo-repo",
    "pathWithNamespace": "60de7a6852743a5162b5f957/DemoRepo",
    "repositorySize": "1",
    "repositoryTags": [
        {
            "tagColor": "#C4C6CF",
            "tagName": "Tag 1"
        }
    ],
    "starCount": 1,
    "starred": false,
    "updatedAt": "2024-10-05T15:30:45Z",
    "visibility": "private",
    "webUrl": "http://example.com/org-demo/example-repo"
}

Error codes

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