Creating a Repository
Description
This API is used to create 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
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
import_members |
No |
Integer |
Whether to import project members. 0: No. 1: Yes. |
|
name |
Yes |
String |
Repo name. Start with a letter and use only letters, digits, hyphens (-), and underscores (_). |
|
project_uuid |
Yes |
String |
Project ID. For details, see Obtaining a Project ID. Minimum length: 32 Maximum length: 32 |
|
template_id |
No |
String |
Template ID |
|
visibility_level |
No |
Integer |
Repository status. 0: private; 20: public and read-only. |
|
import_url |
No |
String |
Base64-encoded HTTP address of the template repository |
|
description |
No |
String |
Repository description |
|
gitignore_id |
No |
String |
.gitignore file generated based on the programming language |
|
license_id |
No |
Integer |
License ID |
|
enable_readme |
No |
Integer |
Whether to generate a README file |
|
caller |
No |
String |
Caller |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
error |
Error object |
Response error |
|
result |
Repository object |
Response result |
|
status |
String |
Response status |
Request Examples
POST https://{endpoint}/v1/repositories
{
"project_uuid": "4838955a48e2492bbe44b31bc4c272f6",
"name": "demotest1",
"import_members": "0",
"visibility_level": "20",
}
Response Examples
Status code: 200
Request succeeded
{
"result" : {
"repository_uuid" : "d161fd00d9194816a455cb3c1d6a783e"
},
"status" : "success"
}
Status Codes
|
Status Codes |
Description |
|---|---|
|
200 |
Request succeeded |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot