milestones.md 3.78 KB
Newer Older
Evan Read's avatar
Evan Read committed
1
# Project milestones API
Marin Jankovski's avatar
Marin Jankovski committed
2

Nihad Abbasov's avatar
Nihad Abbasov committed
3
4
## List project milestones

5
Returns a list of project milestones.
Nihad Abbasov's avatar
Nihad Abbasov committed
6
7
8

```
GET /projects/:id/milestones
9
GET /projects/:id/milestones?iids[]=42
Jarka Kadlecova's avatar
Jarka Kadlecova committed
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
Nihad Abbasov's avatar
Nihad Abbasov committed
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
[
  {
Johannes Schleifenbaum's avatar
Johannes Schleifenbaum committed
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",
Johannes Schleifenbaum's avatar
Johannes Schleifenbaum committed
41
    "state": "active",
42
    "percentage_complete" : 66,
Johannes Schleifenbaum's avatar
Johannes Schleifenbaum committed
43
44
    "updated_at": "2013-10-02T09:24:18Z",
    "created_at": "2013-10-02T09:24:18Z"
45
46
47
48
  }
]
```

49
50
51
## Get single milestone

Gets a single project milestone.
Nihad Abbasov's avatar
Nihad Abbasov committed
52
53
54
55
56
57
58

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

Parameters:

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

## Create new milestone
Nihad Abbasov's avatar
Nihad Abbasov committed
63

64
Creates a new project milestone.
Nihad Abbasov's avatar
Nihad Abbasov committed
65
66
67
68
69
70
71

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

Parameters:

72
- `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
73
- `title` (required) - The title of a milestone
74
75
- `description` (optional) - The description of the milestone
- `due_date` (optional) - The due date of the milestone
76
- `start_date` (optional) - The start date of the milestone
77

Nihad Abbasov's avatar
Nihad Abbasov committed
78
79
## Edit milestone

80
Updates an existing project milestone.
Nihad Abbasov's avatar
Nihad Abbasov committed
81
82
83
84
85
86
87

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

Parameters:

88
- `id` (required) - The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user
89
90
91
92
- `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
93
- `start_date` (optional) - The start date of the milestone
94
- `state_event` (optional) - The state event of the milestone (close|activate)
95

96
97
98
99
100
101
102
103
104
105
106
107
108
## 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

109
110
111
112
113
114
115
116
117
118
## 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:

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

## 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:

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