373.md 1.0 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
# Suggest Changes API

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

*   [Applying suggestions](#applying-suggestions)

# Suggest Changes API[](#suggest-changes-api "Permalink")

每个对建议的 API 调用都必须经过验证.

## Applying suggestions[](#applying-suggestions "Permalink")

在合并请求中应用建议的补丁. 用户必须至少是[Developer](../user/permissions.html)才能执行此操作.

```
PUT /suggestions/:id/apply 
```

| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer/string | yes | 建议的 ID |

```
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/suggestions/5/apply" 
```

响应示例:

```
 {  "id":  36,  "from_line":  10,  "to_line":  10,  "appliable":  false,  "applied":  true,  "from_content":  " \"--talk-name=org.freedesktop.\",\n",  "to_content":  " \"--talk-name=org.free.\",\n  \"--talk-name=org.desktop.\",\n"  } 
```