API V3 to API V4
API V3 to API V4
从 GitLab 9.0 开始,API V4 是首选的版本.
API V3 从 GitLab 9.5 不支持的,在 8 月 22 日公布,2017 年 API V3 中取出GitLab 11.0 . V3 API 文档仍然可用 .
以下是 V3 和 V4 之间所做的更改.
8.17
- Removed
GET /projects/:search
(use:GET /projects?search=x
) !8877 iid
过滤器已从GET /projects/:id/issues
!8967 中删除.GET /projects/:id/merge_requests?iid[]=x&iid[]=y
数组过滤器已重命名为iids
!8793GET /projects/merge_request/:id
下的端点已被删除(使用:GET /projects/merge_requests/:id
) !8793- 项目摘要不返回不建议使用的字段
expires_at
!8723 GET /projects/:id/keys
下的端点已被删除(使用GET /projects/:id/deploy_keys
) !8716
9.0
- 当成员已经存在时,为
POST /projects/:id/members
返回状态 409 !9093 - Moved
DELETE /projects/:id/star
toPOST /projects/:id/unstar
!9328 - 删除了以下不建议使用的模板端点(仍然可以使用
/templates
前缀访问这些端点) !8853/licenses
/licenses/:key
/gitignores
/gitlab_ci_ymls
/dockerfiles
/gitignores/:key
/gitlab_ci_ymls/:key
/dockerfiles/:key
- Moved
POST /projects/fork/:id
toPOST /projects/:id/fork
!8940 - Moved
DELETE /todos
toPOST /todos/mark_as_done
andDELETE /todos/:todo_id
toPOST /todos/:todo_id/mark_as_done
!9410 - 项目过滤器不再作为
GET /projects/foo
,而是作为GET /projects?foo=true
代替!8962GET /projects/visible
和GET /projects/all
合并到GET /projects
,可以在有或没有授权的情况下使用GET /projects/owned
移至GET /projects?owned=true
GET /projects/starred
移至GET /projects?starred=true
GET /projects
返回当前用户可见的所有项目,即使该用户不是成员!9674- 要获取用户所属的
GET /projects?membership=true
,请使用GET /projects?membership=true
- 要获取用户所属的
- 返回所有返回数组的端点的分页头!8606
- 添加了
POST /environments/:environment_id/stop
以停止环境!8808 - 删除了
DELETE /projects/:id/deploy_keys/:key_id/disable
使用DELETE /projects/:id/deploy_keys/:key_id
代替!9366 - Moved
PUT /users/:id/(block|unblock)
toPOST /users/:id/(block|unblock)
!9371 - 使订阅 API 更 RESTful. 使用
POST /projects/:id/:subscribable_type/:subscribable_id/subscribe
进行订阅,并使用POST /projects/:id/:subscribable_type/:subscribable_id/unsubscribe
取消订阅资源. !9325 - 标签在
GET /projects/:id/issues
上过滤,并且GET /issues
现在仅匹配包含所有标签的问题(即:逻辑 AND,而非 OR) !8849 - 将参数
branch_name
重命名为在以下端点上branch
!8936POST /projects/:id/repository/branches
POST /projects/:id/repository/commits
POST/PUT/DELETE :id/repository/files
- 改名
merge_when_build_succeeds
参数merge_when_pipeline_succeeds
以下端点: !9335PUT /projects/:id/merge_requests/:merge_request_id/merge
POST /projects/:id/merge_requests/:merge_request_id/cancel_merge_when_pipeline_succeeds
POST /projects
POST /projects/user/:user_id
PUT /projects/:id
- Renamed
branch_name
tobranch
onDELETE /projects/:id/repository/branches/:branch
response !8936 - 从项目的创建和编辑操作中删除
public
参数!8736 - 从返回问题列表或合并请求的响应中删除已
subscribed
字段. 获取单个问题或合并请求以获取已subscribed
!9661的值 - 在各处使用
visibility
作为字符串参数!9337 - Notes do not return deprecated field
upvote
anddownvote
!9384 - 创建或更新成员时,针对所有验证错误返回 HTTP 状态代码
400
,而不是有时为422
错误. !9523 - 删除
GET /groups/owned
. 使用GET /groups?owned=true
代替!9505 - 在 V4 API 上以异步删除方式返回带有 JSON 正文的 202(
DELETE /projects/:id/repository/merged_branches
和DELETE /projects/:id
) !9449 GET /projects/:id/milestones?iid[]=x&iid[]=y
数组过滤器已重命名为iids
!9096- 在
GET /projects/:id/pipelines
返回有关管道的基本信息!8875 - 将所有
build
参考重命名为job
!9463 - Drop
GET /projects/:id/repository/commits/:sha/jobs
!9463 - Rename Build Triggers to be Pipeline Triggers API !9713 将构建触发器重命名为管道触发器 API !9713
POST /projects/:id/trigger/builds
toPOST /projects/:id/trigger/pipeline
POST /projects/:id/trigger/builds
到POST /projects/:id/trigger/pipeline
- Require description when creating a new trigger
POST /projects/:id/triggers
创建新触发器POST /projects/:id/triggers
时需要说明POST /projects/:id/triggers
- 简化环境端点上暴露的项目有效负载!9675
- API uses merge request
IID
s (internal ID, as in the web UI) rather thanID
s. This affects the merge requests, award emoji, todos, and time tracking APIs. !9530 - API 使用问题
IID
(内部 ID,如 Web UI),而不使用ID
. 这会影响问题,奖励表情符号,待办事项和时间跟踪 API. !9530 - 将
GET /projects/:id/repository/commits
上的初始页面从0
更改为1
(类似于 API 的其余部分) !9679 - 返回正确的
GET /projects/:id/repository/commits
Link
标头数据!9679 - 更新存储库文件的端点!9637
- 将
GET /projects/:id/repository/files?file_path=:file_path
移到GET /projects/:id/repository/files/:file_path
(:file_path
应该用 URL 编码) GET /projects/:id/repository/blobs/:sha
现在返回由:sha
标识的 blob 的 JSON 属性,而不是查找由:sha
标识的提交,并在必需的?filepath=:filepath
标识的那个提交中返回 blob 的原始内容?filepath=:filepath
- 将
GET /projects/:id/repository/commits/:sha/blob?file_path=:file_path
和GET /projects/:id/repository/blobs/:sha?file_path=:file_path
移至GET /projects/:id/repository/files/:file_path/raw?ref=:sha
GET /projects/:id/repository/tree
参数ref_name
已重命名为ref
以保持一致性
- 将
confirm
为参数POST /users
已被弃用,取而代之的skip_confirmation
参数