添加依赖
POST
支持单个或批量添加,名称与已有依赖重复或为平台保留依赖时添加失败,添加成功的依赖处于未安装状态。
Tokenheader
api-token<token>32位令牌,在控制面板《个人设置 - 令牌管理》页面获取
application/json- body
添加依赖请求体
name*|array<string>依赖名称(单个或数组,支持批量添加,可包含版本表达式)
ecosystem*DependencyEcosystem包管理生态
值于
"npm""pnpm""pip""apt""luarocks""gem"remark?string备注
返回添加后的依赖信息,批量添加时返回成功添加的数量
application/json- response
依赖完整记录(响应数据)
id*integer唯一标识
name*string依赖名称
ecosystem*DependencyEcosystem包管理生态
值于
"npm""pnpm""pip""apt""luarocks""gem"installed_ver*string已安装版本,未安装时为空字符串
status*DependencyStatus安装状态,0 未安装、1 安装中、2 已安装、3 安装失败、4 卸载中
值于
01234last_error*string最近一次操作的错误信息,无错误时为空字符串
remark*string备注
create_time*string创建时间
格式
date-timeupdate_time*string更新时间
格式
date-timecurl -X POST "https://example.com/dependency/v1/create" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "ecosystem": "npm" }'{ "id": 0, "name": "string", "ecosystem": "npm", "installed_ver": "string", "status": 0, "last_error": "string", "remark": "string", "create_time": "2019-08-24T14:15:22Z", "update_time": "2019-08-24T14:15:22Z"}
