milestones.md 4.2 KB
Newer Older
1
# Project milestones API
2

3 4
## List project milestones

5
Returns a list of project milestones.
6 7 8

```
GET /projects/:id/milestones
9
GET /projects/:id/milestones?iids[]=42
10
GET /projects/:id/milestones?iids[]=42&iids[]=43
11 12
GET /projects/:id/milestones?state=active
GET /projects/:id/milestones?state=closed
13
GET /projects/:id/milestones?search=version
14 15
```

16 17 18 19
Parameters:

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
20
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
21
| `iids[]` | Array[integer] | optional | Return only the milestones having the given `iid` |
22
| `state` | string | optional | Return only `active` or `closed` milestones |
23
| `search` | string | optional | Return only milestones with a title or description matching the provided string |
24 25

```bash
26
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/milestones
27 28 29 30
```

Example Response:

31 32 33
```json
[
  {
34 35 36 37 38 39
    "id": 12,
    "iid": 3,
    "project_id": 16,
    "title": "10.0",
    "description": "Version",
    "due_date": "2013-11-29",
40
    "start_date": "2013-11-10",
41 42 43
    "state": "active",
    "updated_at": "2013-10-02T09:24:18Z",
    "created_at": "2013-10-02T09:24:18Z"
44 45 46 47
  }
]
```

48 49 50
## Get single milestone

Gets a single project milestone.
51 52 53 54 55 56 57

```
GET /projects/:id/milestones/:milestone_id
```

Parameters:

58
- `id` (required) - The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user
59
- `milestone_id` (required) - The ID of the project's milestone
60 61

## Create new milestone
62

63
Creates a new project milestone.
64 65 66 67 68 69 70

```
POST /projects/:id/milestones
```

Parameters:

71
- `id` (required) - The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user
Ville Skyttä's avatar
Ville Skyttä committed
72
- `title` (required) - The title of a milestone
73 74
- `description` (optional) - The description of the milestone
- `due_date` (optional) - The due date of the milestone
75
- `start_date` (optional) - The start date of the milestone
76

77 78
## Edit milestone

79
Updates an existing project milestone.
80 81 82 83 84 85 86

```
PUT /projects/:id/milestones/:milestone_id
```

Parameters:

87
- `id` (required) - The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user
88 89 90 91
- `milestone_id` (required) - The ID of a project milestone
- `title` (optional) - The title of a milestone
- `description` (optional) - The description of a milestone
- `due_date` (optional) - The due date of the milestone
92
- `start_date` (optional) - The start date of the milestone
93
- `state_event` (optional) - The state event of the milestone (close|activate)
94

95 96 97 98 99 100 101 102 103 104 105 106 107
## Delete project milestone

Only for user with developer access to the project.

```
DELETE /projects/:id/milestones/:milestone_id
```

Parameters:

- `id` (required) - The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user
- `milestone_id` (required) - The ID of the project's milestone

108 109 110 111 112 113 114 115 116 117
## Get all issues assigned to a single milestone

Gets all issues assigned to a single project milestone.

```
GET /projects/:id/milestones/:milestone_id/issues
```

Parameters:

118
- `id` (required) - The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user
119
- `milestone_id` (required) - The ID of a project milestone
120 121 122 123 124 125 126 127 128 129 130

## Get all merge requests assigned to a single milestone

Gets all merge requests assigned to a single project milestone.

```
GET /projects/:id/milestones/:milestone_id/merge_requests
```

Parameters:

131
- `id` (required) - The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user
132
- `milestone_id` (required) - The ID of a project milestone
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147

## Promote project milestone to a group milestone

> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/53861) in GitLab 11.9

Only for users with developer access to the group.

```
POST /projects/:id/milestones/:milestone_id/promote
```

Parameters:

- `id` (required) - The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user
- `milestone_id` (required) - The ID of a project milestone