From 6b2673bc7ac0c51152b0e355ab99360f551438d3 Mon Sep 17 00:00:00 2001 From: Robert Schilling Date: Thu, 14 Feb 2019 12:30:18 +0100 Subject: Add new to test bulk_update endpoint for issues and MRs Add documentation for issues and MRs. Add shared tests for both bulk updating issues and MRs. --- doc/api/issues.md | 31 +++++++++++++++++++++++++++++++ doc/api/merge_requests.md | 31 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) (limited to 'doc') diff --git a/doc/api/issues.md b/doc/api/issues.md index ed3165d95df..ccd28d21e98 100644 --- a/doc/api/issues.md +++ b/doc/api/issues.md @@ -635,6 +635,37 @@ Example response: **Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists. +## Bulk update issues + +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21368) in GitLab 11.8. + +Update multiple issues using a single API call. Returns the number of successfully updated issues. + +``` +PUT /projects/:id/issues/bulk_update +``` + +| Attribute | Type | Required | Description **** | +|----------------|---------|----------|------------------------------------------------------------------------------------------------------------| +| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. | +| `issuable_ids` | Array[integer] | yes | The IDs of issues to be updated. | +| `assignee_ids` | Array[integer] | no | The ID of the user(s) to assign the issue to. Set to `0` or provide an empty value to unassign all assignees. | +| `milestone_id` | integer | no | The global ID of a milestone to assign the issue to. Set to `0` or provide an empty value to unassign a milestone.| +| `add_label_ids` | Array[integer] | no | Comma-separated label IDs to be added. | +| `remove_label_ids` | Array[integer] | no | Comma-separated label IDs to be added. | +| `state_event` | string | no | The state event of an issue. Set `close` to close the issue and `reopen` to reopen it. | +| `subscription_event` | string | no | The subscription_event event of an issue. Set `subscribe` to subscribe to the issue and `unsubscribe` to unsubscribe from it. | + +```bash +curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/4/issues/bulk_update?issuable_ids[]=1&issuable_ids[]=2&state_event=close +``` + +Example response: + +```json +{ "message": "2 issues updated" } +``` + ## Delete an issue Only for admins and project owners. Soft deletes the issue in question. diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index d58cd45538d..05bc3d098c5 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -956,6 +956,37 @@ Must include at least one non-required attribute from above. } ``` +## Bulk update merge requests + +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21368) in GitLab 11.8. + +Update multiple merge requests using a single API call. Returns the number of successfully updated merge requests. + +``` +PUT /projects/:id/merge_requests/bulk_update +``` + +| Attribute | Type | Required | Description **** | +|----------------|---------|----------|------------------------------------------------------------------------------------------------------------| +| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. | +| `issuable_ids` | Array[integer] | yes | The IDs of merge requests to be updated. | +| `assignee_ids` | Array[integer] | no | The ID of the user(s) to assign the issue to. Set to `0` or provide an empty value to unassign all assignees. | +| `milestone_id` | integer | no | The global ID of a milestone to assign the issue to. Set to `0` or provide an empty value to unassign a milestone.| +| `add_label_ids` | Array[integer] | no | Comma-separated label IDs to be added. | +| `remove_label_ids` | Array[integer] | no | Comma-separated label IDs to be added. | +| `state_event` | string | no | The state event of an issue. Set `close` to close the issue and `reopen` to reopen it. | +| `subscription_event` | string | no | The subscription_event event of an issue. Set `subscribe` to subscribe to the issue and `unsubscribe` to unsubscribe from it. | + +```bash +curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/4/merge_requests/bulk_update?issuable_ids[]=1&issuable_ids[]=2&state_event=close +``` + +Example response: + +```json +{ "message": "2 merge_requests updated" } +``` + ## Delete a merge request Only for admins and project owners. Soft deletes the merge request in question. -- cgit v1.2.3