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 IAM API. The value of X-Subject-Token in the response header is the user token. Constraints: Mandatory 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: 0 |
name |
Yes |
String |
Explanation: Repository name. Constraints: Mandatory Range:
Default value: None |
project_uuid |
Yes |
String |
Explanation: Project ID. Constraints: Mandatory Range: 32 characters. Default value: None |
template_id |
No |
String |
Explanation: Template ID. Constraints: None Range: Character string Default value: None |
visibility_level |
No |
Integer |
Explanation: Repository visibility. Constraints: None Range:
Default value: 0 |
import_url |
No |
String |
Explanation: Base64-encoded HTTPS address of the template repository. Constraints: None Range: 10–512 characters. Default value: None |
description |
No |
String |
Explanation: Repository description. Constraints: None Range: [0-2000] Default value: None |
gitignore_id |
No |
String |
Explanation: .gitignore file generated based on the programming language. Constraints: None Range: Actionscript,Ada,Agda,Android,Ansible,AppceleratorTitanium,AppEngine,ArchLinuxPackages,Autotools,C#,C++,C,CakePHP,CFWheels,ChefCookbook,Clojure,CMake,CodeIgniter,CommonLisp,Composer,Concrete5,Coq,CraftCMS,CUDA,D,Dart,Delphi,DM,Dreamweaver,Dropbox,Drupal,Eagle,Eclipse,Elisp,Elixir,Elm,Emacs,EPiServer,Erlang,ExpressionEngine,ExtJs,Fancy,Finale,ForceDotCom,Fortran,FuelPHP,Gcov,GitBook,Go,Godot,GPG,Gradle,Grails,GWT,Haskell,Idris,IGORPro,Java,JavaScript,Jboss,Jekyll,JetBrains,Joomla,Julia,KiCad,Kohana,Kotlin,LabVIEW,Laravel,Leiningen,LemonStand,Lilypond,Lithium,Lua,Magento,Maven,Mercury,MetaProgrammingSystem,Nanoc,NetBeans,Nim,Node,NotepadPP,Objective-C,OCaml,Opa,OpenCart,OracleForms,Packer,Perl,Phalcon,PlayFramework,Plone,Prestashop,Processing,PureScript,Python,Qooxdoo,Qt,R,Rails,RhodesRhomobile,ROS,Ruby,Rust,Sass,Scala,Scheme,SCons,Scrivener,Sdcc,SeamGen,SketchUp,Smalltalk,Stella,SublimeText,SugarCRM,SVN,Swift,Symfony,SymphonyCMS,Terraform,TeX,Textpattern,TortoiseGit,TurboGears2,Typo3,Umbraco,Unity,UnrealEngine,VisualStudio,VisualStudioCode,VVVV,Waf,WordPress,Xojo,Yeoman,Yii,ZendFramework,Zephir Default value: None |
license_id |
No |
Integer |
Explanation: Open-source license ID. Constraints: None Range:
Default value: None |
enable_readme |
No |
Integer |
Explanation: Whether to generate a README file. Constraints: None Range:
Default value: None |
caller |
No |
String |
Explanation: Caller. Constraints: None Range: Character string Default value: None |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Explanation: Response error. |
result |
Repository object |
Explanation: Response result. |
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 Codes
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.