387.md 9.3 KB
Newer Older
Lab机器人's avatar
readme  
Lab机器人 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
# API V3 to API V4

> 原文:[https://docs.gitlab.com/ee/api/v3_to_v4.html](https://docs.gitlab.com/ee/api/v3_to_v4.html)

*   [8.17](#817)
*   [9.0](#90)

# API V3 to API V4[](#api-v3-to-api-v4 "Permalink")

从 GitLab 9.0 开始,API V4 是首选的版本.

API V3 从 GitLab 9.5 不支持的,在 8 月 22 日公布,2017 年 API V3 中取出[GitLab 11.0](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/36819) . V3 API 文档仍然[可用](https://gitlab.com/gitlab-org/gitlab-foss/blob/8-16-stable/doc/api/README.md) .

以下是 V3 和 V4 之间所做的更改.

## 8.17[](#817 "Permalink")

*   Removed `GET /projects/:search` (use: `GET /projects?search=x`) [!8877](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8877)
*   `iid`过滤器已从`GET /projects/:id/issues` [!8967 中](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8967)删除[.](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8967)
*   `GET /projects/:id/merge_requests?iid[]=x&iid[]=y`数组过滤器已重命名为`iids` [!8793](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8793)
*   `GET /projects/merge_request/:id`下的端点已被删除(使用: `GET /projects/merge_requests/:id`[!8793](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8793)
*   项目摘要不返回不建议使用的字段`expires_at` [!8723](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8723)
*   `GET /projects/:id/keys`下的端点已被删除(使用`GET /projects/:id/deploy_keys`[!8716](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8716)

## 9.0[](#90 "Permalink")

*   当成员已经存在时,为`POST /projects/:id/members`返回状态 409 [!9093](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9093)
*   Moved `DELETE /projects/:id/star` to `POST /projects/:id/unstar` [!9328](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9328)
*   删除了以下不建议使用的模板端点(仍然可以使用`/templates`前缀访问这些端点) [!8853](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/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](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8940)
*   Moved `DELETE /todos` to `POST /todos/mark_as_done` and `DELETE /todos/:todo_id` to `POST /todos/:todo_id/mark_as_done` [!9410](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9410)
*   项目过滤器不再作为`GET /projects/foo` ,而是作为`GET /projects?foo=true`代替[!8962](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8962)
    *   `GET /projects/visible``GET /projects/all`合并到`GET /projects` ,可以在有或没有授权的情况下使用
    *   `GET /projects/owned`移至`GET /projects?owned=true`
    *   `GET /projects/starred`移至`GET /projects?starred=true`
*   `GET /projects`返回当前用户可见的所有项目,即使该用户不是成员[!9674](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9674)
    *   要获取用户所属的`GET /projects?membership=true` ,请使用`GET /projects?membership=true`
*   返回所有返回数组的端点的分页头[!8606](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8606)
*   添加了`POST /environments/:environment_id/stop`以停止环境[!8808](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8808)
*   删除了`DELETE /projects/:id/deploy_keys/:key_id/disable` 使用`DELETE /projects/:id/deploy_keys/:key_id`代替[!9366](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9366)
*   Moved `PUT /users/:id/(block|unblock)` to `POST /users/:id/(block|unblock)` [!9371](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9371)
*   使订阅 API 更 RESTful. 使用`POST /projects/:id/:subscribable_type/:subscribable_id/subscribe`进行订阅,并使用`POST /projects/:id/:subscribable_type/:subscribable_id/unsubscribe`取消订阅资源. [!9325](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9325)
*   标签在`GET /projects/:id/issues`上过滤,并且`GET /issues`现在仅匹配包含所有标签的问题(即:逻辑 AND,而非 OR) [!8849](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8849)
*   将参数`branch_name`重命名为在以下端点上`branch` [!8936](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/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](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/)
    *   `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](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8936)
*   从项目的创建和编辑操作中删除`public`参数[!8736](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8736)
*   从返回问题列表或合并请求的响应中删除已`subscribed`字段. 获取单个问题或合并请求以获取已`subscribed` [!9661](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9661)的值
*   在各处使用`visibility`作为字符串参数[!9337](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9337)
*   Notes do not return deprecated field `upvote` and `downvote` [!9384](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9384)
*   创建或更新成员时,针对所有验证错误返回 HTTP 状态代码`400` ,而不是有时为`422`错误. [!9523](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9523)
*   删除`GET /groups/owned` . 使用`GET /groups?owned=true`代替[!9505](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9505)
*   在 V4 API 上以异步删除方式返回带有 JSON 正文的 202( `DELETE /projects/:id/repository/merged_branches``DELETE /projects/:id`[!9449](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9449)
*   `GET /projects/:id/milestones?iid[]=x&iid[]=y`数组过滤器已重命名为`iids` [!9096](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9096)
*`GET /projects/:id/pipelines`返回有关管道的基本信息[!8875](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8875)
*   将所有`build`参考重命名为`job` [!9463](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9463)
*   Drop `GET /projects/:id/repository/commits/:sha/jobs` [!9463](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9463)
*   Rename Build Triggers to be Pipeline Triggers API [!9713](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9713) 将构建触发器重命名为管道触发器 API [!9713](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9713)
    *   `POST /projects/:id/trigger/builds` to `POST /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](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9675)
*   API uses merge request `IID`s (internal ID, as in the web UI) rather than `ID`s. This affects the merge requests, award emoji, todos, and time tracking APIs. [!9530](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9530)
*   API 使用问题`IID` (内部 ID,如 Web UI),而不使用`ID` . 这会影响问题,奖励表情符号,待办事项和时间跟踪 API. [!9530](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9530)
*`GET /projects/:id/repository/commits`上的初始页面从`0`更改为`1` (类似于 API 的其余部分) [!9679](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9679)
*   返回正确的`GET /projects/:id/repository/commits` `Link`标头数据[!9679](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9679)
*   更新存储库文件的端点[!9637](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/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`参数