API V3 to API V4

原文:https://docs.gitlab.com/ee/api/v3_to_v4.html

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 !8793
  • GET /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 to POST /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 to POST /projects/:id/fork !8940
  • Moved DELETE /todos to POST /todos/mark_as_done and DELETE /todos/:todo_id to POST /todos/:todo_id/mark_as_done !9410
  • 项目过滤器不再作为GET /projects/foo ,而是作为GET /projects?foo=true代替!8962
    • GET /projects/visibleGET /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) to POST /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 !8936
    • POST /projects/:id/repository/branches
    • POST /projects/:id/repository/commits
    • POST/PUT/DELETE :id/repository/files
  • 改名merge_when_build_succeeds参数merge_when_pipeline_succeeds以下端点: !9335
    • PUT /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 to branch on DELETE /projects/:id/repository/branches/:branch response !8936
  • 从项目的创建和编辑操作中删除public参数!8736
  • 从返回问题列表或合并请求的响应中删除已subscribed字段. 获取单个问题或合并请求以获取已subscribed !9661的值
  • 在各处使用visibility作为字符串参数!9337
  • Notes do not return deprecated field upvote and downvote !9384
  • 创建或更新成员时,针对所有验证错误返回 HTTP 状态代码400 ,而不是有时为422错误. !9523
  • 删除GET /groups/owned . 使用GET /groups?owned=true代替!9505
  • 在 V4 API 上以异步删除方式返回带有 JSON 正文的 202( DELETE /projects/:id/repository/merged_branchesDELETE /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 to POST /projects/:id/trigger/pipeline POST /projects/:id/trigger/buildsPOST /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 IIDs (internal ID, as in the web UI) rather than IDs. 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_pathGET /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参数