更新时间:2024-10-26 gmt 08:00

创建仓库-九游平台

功能介绍

用指定的名称在指定项目上创建仓库。传入参数:仓库名、模板id、是否导入项目成员、归属项目

调试

您可以在中调试该接口,支持自动认证鉴权。api explorer可以自动生成sdk代码示例,并提供sdk代码示例调试功能。

uri

post /v1/repositories

请求参数

表1 请求header参数

参数

是否必选

参数类型

描述

x-auth-token

string

参数解释:

用户token。通过调用iam服务获取用户token接口获取(响应消息头中x-subject-token的值)。

约束限制:

必传。

取值范围:

字符串长度不少于1,不超过10万。

默认取值:

不涉及。

表2 请求body参数

参数

是否必选

参数类型

描述

import_members

integer

参数解释

是否导入项目成员。

约束限制

不涉及。

取值范围:

  • 0,不导入项目成员
  • 1,导入项目成员

默认取值:

0

name

string

参数解释

仓库名称

约束限制

必传

取值范围:

  • 以大小写字母、数字、下划线开头,可包含大小写字母、数字、中划线、下划线、英文句点,但不能以.git、.atom或.结尾
  • 长度[1-256]

默认取值:

不涉及

project_uuid

string

参数解释

指定项目id

约束限制

必传

取值范围:

32位字符串

默认取值:

不涉及

template_id

string

参数解释

复制模板的id

约束限制

不涉及

取值范围:

字符串

默认取值:

不涉及

visibility_level

integer

参数解释

仓库可见性

约束限制

不涉及

取值范围:

  • 0,私有
  • 20,公开只读

默认取值:

0

import_url

string

参数解释

模板仓库的https地址的base64加密

约束限制

不涉及

取值范围:

url长度[10-512]

默认取值:

不涉及

description

string

参数解释

仓库描述信息

约束限制

不涉及

取值范围:

[0-2000]

默认取值:

不涉及

gitignore_id

string

参数解释

根据编程语言生成.gitignore文件

约束限制

不涉及

取值范围:

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

默认取值:

不涉及

license_id

integer

参数解释

开源许可证id

约束限制

不涉及

取值范围:

  • 1,apache_license_v2.0
  • 2,mit_license,,bsd_3clause
  • 3,eclipse_public_license_v1.0
  • 4,bsd_2clause
  • 5,gnu_general_public_license_v2.0
  • 6,gnu_general_public_license_v3.0
  • 7,gnu_affero_general_public_license_v3.0
  • 8,gnu_lesser_general_public_license_v2.1
  • 9,gnu_lesser_general_public_license_v3.0
  • 10,mozilla_public_license_v2.0
  • 11,the_unlicense

默认取值:

不涉及

enable_readme

integer

参数解释

是否允许生成readme文件

约束限制

不涉及

取值范围:

  • true:创建
  • false:不创建

默认取值:

不涉及

caller

string

参数解释

调用者

约束限制

不涉及

取值范围:

字符串

默认取值:

不涉及

响应参数

状态码: 200

表3 响应body参数

参数

参数类型

描述

error

error object

参数解释

响应错误:

result

repository object

参数解释

响应结果

status

string

参数解释

响应状态

取值范围:

  • success
  • fail
表4 error

参数

参数类型

描述

code

string

参数解释

错误码

取值范围:

请参见错误码

message

string

参数解释

错误信息

取值范围:

字符串

表5 repository

参数

参数类型

描述

repository_uuid

string

参数解释

指定项目id

取值范围:

32位字符串

请求示例

post https://{endpoint}/v1/repositories
{
	"project_uuid": "4838955a48e2492bbe44b31bc4c272f6", 
	"name": "demotest1", 
	"import_members": "0", 
	"visibility_level": "20", 
 }

响应示例

状态码: 200

ok

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

状态码

状态码

描述

200

ok

错误码

请参见错误码

相关文档

网站地图