Creating a Repository
Function
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 |
Explanation: User token. It can be obtained by calling the corresponding Obtaining a User Token. The value of X-Subject-Token in the response header is the user token. Constraints: N/A Range: 1–100,000 characters. Default value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
import_members |
No |
Integer |
Explanation: Whether to import project members. Constraints: N/A Range:
Default value 0 |
|
name |
Yes |
String |
Explanation: Repository name. Constraints: Start with a letter, digit, or underscore (_), and use letters, digits, hyphens (-), underscores (_), and periods (.). Do not end with .git, .atom, or a period (.). Range: The value is a string of 1 to 256 characters. Default value N/A |
|
project_uuid |
Yes |
String |
Explanation: Project ID. For details, see Obtaining a Project ID. Constraints: N/A Range: 32 digits and letters. Default value N/A |
|
template_id |
No |
String |
Explanation: Template ID. Constraints: N/A Range: N/A Default value N/A |
|
visibility_level |
No |
Integer |
Explanation: Repository visibility. Constraints: N/A Range:
Default value 0 |
|
import_url |
No |
String |
Explanation: Base64 code of the HTTPS address of the template repository. Constraints: N/A Range: The value is a string of 10 to 512 characters. Default value N/A |
|
description |
No |
String |
Explanation: Repository description. Constraints: N/A Range: The value is a string of 0 to 2,000 characters. Default value N/A |
|
gitignore_id |
No |
String |
Explanation: .gitignore file generated based on the programming language. Constraints: N/A Range: For details about the available languages, see gitignore file template languages. Default value N/A |
|
license_id |
No |
Integer |
Explanation: Open-source license ID. Constraints: N/A Range:
Default value N/A |
|
enable_readme |
No |
Integer |
Explanation: Whether to generate a README file. Constraints: N/A Range:
Default value N/A |
|
caller |
No |
String |
Explanation: API caller, that is, repository creator. Constraints: N/A Range: N/A Default value N/A |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
error |
Error object |
Explanation: Response error code. Range: N/A |
|
result |
Repository object |
Explanation: Response result. Range: N/A |
|
status |
String |
Explanation: Response status. Range:
|
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 Code
|
Status Code |
Description |
|---|---|
|
200 |
OK |
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