Updated on 2023-09-12 GMT+08:00

Creating a repository

Function

Creates a repository on a specified project with the specified name. Input parameters: repository name, template ID, whether to import project members, and home project

URI

POST /v1/repositories

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the user token.

It can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

import_members

No

Integer

Indicates whether to import project members. The options are as follows: 0->Do not import project members; 1->Import project members

name

Yes

String

Repository name. The options are as follows: The value can contain uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_), and must start with a letter.

project_uuid

Yes

String

Specifies the UUID of a project.

Minimum: 32

Maximum: 32

template_id

No

String

ID of the replication template.

visibility_level

No

Integer

Warehouse status. The options are as follows: 0: private; 20: public and read-only

import_url

No

String

Encrypting the HTTPS Address of the Template Repository Using Base64

description

No

String

Repository description.

gitignore_id

No

String

Generating the .gitignore File Based on the Programming Language

license_id

No

Integer

License ID

enable_readme

No

Integer

Indicates whether to allow README file generation.

caller

No

String

Invoker

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

error

Error object

Response error.

result

Repository object

Result

status

String

Response Status

Table 4 Error

Parameter

Type

Description

code

String

Error Codes

message

String

Error message

Table 5 Repository

Parameter

Type

Description

repository_uuid

String

UUID of the repository to be created.

Minimum: 32

Maximum: 32

Example Requests

POST https://{endpoint}/v1/repositories

{
	"project_uuid": "4838955a48e2492bbe44b31bc4c272f6", 
	"name": "demotest1", 
	"import_members": "0", 
	"visibility_level": "20", 
 }

Example Responses

Status code: 200

OK

{
  "result" : {
    "repository_uuid" : "d161fd00d9194816a455cb3c1d6a783e"
  },
  "status" : "success"
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.