Creating a Project and Forked Repository
Function
This API is used to create a project and create a forked repository based on the source repository.
URI
POST /v2/projects/repositories/fork
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Explanation User token. It can be obtained by calling the corresponding IAM API. The value of X-Subject-Token in the response header is the user token. Constraints None. Range 1–100,000 characters. Default value None. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| import_members | No | Integer | Explanation Whether to import project members. Constraints None. Range
Default value None. |
| project_name | Yes | String | Explanation Project name. Constraints Start with a letter and use only letters, digits, hyphens (-), and underscores (_). Range None. Default Value None. |
| repo_name | Yes | String | Explanation Repository name. Constraints Start with a letter and use only letters, digits, hyphens (-), and underscores (_). Range None. Default value: 2–128 |
| template_id | Yes | String | Explanation Source repository ID. You can query the repository list by calling the Querying All Repositories of a User API. Constraints None. Range None. Default value: None. |
| type | No | String | Explanation Project type. Constraints None. Range scrum: Scrum project. Default value: scrum |
| visibility_level | No | Integer | Explanation: Repository visibility. Constraints: None. Range
Default value 0 |
| external_project_info | No | ExternalKeyMessage object | Explanation: Third-party service information. Constraints None. Range None. Default value: None. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| external_key_message | No | String | Explanation: Key information stored by third parties in CodeArts Repo. Constraints None. Range None. Default value: None. |
| external_service | No | String | Explanation: External service name. Constraints None. Range None. Default value: None. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| error | Error object | Explanation: Response error. Range None. |
| result | ProjectRepository object | Explanation: Response result. Range None. |
| status | String | Explanation: Response status. Range
|
| Parameter | Type | Description |
|---|---|---|
| code | String | Explanation: Error code. Range Max. 100 characters in the error code format. |
| message | String | Explanation: Error message. Range None. |
| Parameter | Type | Description |
|---|---|---|
| projectUuid | String | Explanation: Project ID. For details, see Obtaining a Project ID. Range 32 digits and letters. |
| repositoryUuid | String | Explanation: Repository UUID. Range 32 digits and letters. |
Example Requests
POST https://{endpoint}/v2/projects/{project_uuid}/repositories/fork
{
"project_name" : "testworld",
"repo_name" : "demotest1",
"template_id" : 453489,
"import_members" : 0,
"visibility_level" : 20,
"type" : "normal"
} Example Responses
Status code: 200
OK
{
"result" : {
"repositoryUuid" : "9a780fd55cd64333b668ba26132629d2",
"projectUuid" : "278a03286efe45c6b788122bfc166976"
},
"status" : "success"
} Status Codes
| Status Codes | 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.