PageRenderTime 47ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 1ms

/doc/api/groups.md

https://gitlab.com/viktor-meszaros2/gitlab-ce
Markdown | 448 lines | 394 code | 54 blank | 0 comment | 0 complexity | c318dac712e126ff09534f62801d68f2 MD5 | raw file
  1. # Groups
  2. ## List groups
  3. Get a list of groups. (As user: my groups or all available, as admin: all groups).
  4. Parameters:
  5. - `all_available` (optional) - if passed, show all groups you have access to
  6. - `skip_groups` (optional)(array of group IDs) - if passed, skip groups
  7. ```
  8. GET /groups
  9. ```
  10. ```json
  11. [
  12. {
  13. "id": 1,
  14. "name": "Foobar Group",
  15. "path": "foo-bar",
  16. "description": "An interesting group"
  17. }
  18. ]
  19. ```
  20. You can search for groups by name or path, see below.
  21. ## List a group's projects
  22. Get a list of projects in this group.
  23. ```
  24. GET /groups/:id/projects
  25. ```
  26. Parameters:
  27. - `archived` (optional) - if passed, limit by archived status
  28. - `visibility` (optional) - if passed, limit by visibility `public`, `internal`, `private`
  29. - `order_by` (optional) - Return requests ordered by `id`, `name`, `path`, `created_at`, `updated_at` or `last_activity_at` fields. Default is `created_at`
  30. - `sort` (optional) - Return requests sorted in `asc` or `desc` order. Default is `desc`
  31. - `search` (optional) - Return list of authorized projects according to a search criteria
  32. - `ci_enabled_first` - Return projects ordered by ci_enabled flag. Projects with enabled GitLab CI go first
  33. ```json
  34. [
  35. {
  36. "id": 9,
  37. "description": "foo",
  38. "default_branch": "master",
  39. "tag_list": [],
  40. "public": false,
  41. "archived": false,
  42. "visibility_level": 10,
  43. "ssh_url_to_repo": "git@gitlab.example.com/html5-boilerplate.git",
  44. "http_url_to_repo": "http://gitlab.example.com/h5bp/html5-boilerplate.git",
  45. "web_url": "http://gitlab.example.com/h5bp/html5-boilerplate",
  46. "name": "Html5 Boilerplate",
  47. "name_with_namespace": "Experimental / Html5 Boilerplate",
  48. "path": "html5-boilerplate",
  49. "path_with_namespace": "h5bp/html5-boilerplate",
  50. "issues_enabled": true,
  51. "merge_requests_enabled": true,
  52. "wiki_enabled": true,
  53. "builds_enabled": true,
  54. "snippets_enabled": true,
  55. "created_at": "2016-04-05T21:40:50.169Z",
  56. "last_activity_at": "2016-04-06T16:52:08.432Z",
  57. "shared_runners_enabled": true,
  58. "creator_id": 1,
  59. "namespace": {
  60. "id": 5,
  61. "name": "Experimental",
  62. "path": "h5bp",
  63. "owner_id": null,
  64. "created_at": "2016-04-05T21:40:49.152Z",
  65. "updated_at": "2016-04-07T08:07:48.466Z",
  66. "description": "foo",
  67. "avatar": {
  68. "url": null
  69. },
  70. "share_with_group_lock": false,
  71. "visibility_level": 10
  72. },
  73. "avatar_url": null,
  74. "star_count": 1,
  75. "forks_count": 0,
  76. "open_issues_count": 3,
  77. "public_builds": true,
  78. "shared_with_groups": [],
  79. "request_access_enabled": false
  80. }
  81. ]
  82. ```
  83. ## Details of a group
  84. Get all details of a group.
  85. ```
  86. GET /groups/:id
  87. ```
  88. Parameters:
  89. | Attribute | Type | Required | Description |
  90. | --------- | ---- | -------- | ----------- |
  91. | `id` | integer/string | yes | The ID or path of a group |
  92. ```bash
  93. curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/groups/4
  94. ```
  95. Example response:
  96. ```json
  97. {
  98. "id": 4,
  99. "name": "Twitter",
  100. "path": "twitter",
  101. "description": "Aliquid qui quis dignissimos distinctio ut commodi voluptas est.",
  102. "visibility_level": 20,
  103. "avatar_url": null,
  104. "web_url": "https://gitlab.example.com/groups/twitter",
  105. "request_access_enabled": false,
  106. "projects": [
  107. {
  108. "id": 7,
  109. "description": "Voluptas veniam qui et beatae voluptas doloremque explicabo facilis.",
  110. "default_branch": "master",
  111. "tag_list": [],
  112. "public": true,
  113. "archived": false,
  114. "visibility_level": 20,
  115. "ssh_url_to_repo": "git@gitlab.example.com:twitter/typeahead-js.git",
  116. "http_url_to_repo": "https://gitlab.example.com/twitter/typeahead-js.git",
  117. "web_url": "https://gitlab.example.com/twitter/typeahead-js",
  118. "name": "Typeahead.Js",
  119. "name_with_namespace": "Twitter / Typeahead.Js",
  120. "path": "typeahead-js",
  121. "path_with_namespace": "twitter/typeahead-js",
  122. "issues_enabled": true,
  123. "merge_requests_enabled": true,
  124. "wiki_enabled": true,
  125. "builds_enabled": true,
  126. "snippets_enabled": false,
  127. "container_registry_enabled": true,
  128. "created_at": "2016-06-17T07:47:25.578Z",
  129. "last_activity_at": "2016-06-17T07:47:25.881Z",
  130. "shared_runners_enabled": true,
  131. "creator_id": 1,
  132. "namespace": {
  133. "id": 4,
  134. "name": "Twitter",
  135. "path": "twitter",
  136. "owner_id": null,
  137. "created_at": "2016-06-17T07:47:24.216Z",
  138. "updated_at": "2016-06-17T07:47:24.216Z",
  139. "description": "Aliquid qui quis dignissimos distinctio ut commodi voluptas est.",
  140. "avatar": {
  141. "url": null
  142. },
  143. "share_with_group_lock": false,
  144. "visibility_level": 20
  145. },
  146. "avatar_url": null,
  147. "star_count": 0,
  148. "forks_count": 0,
  149. "open_issues_count": 3,
  150. "public_builds": true,
  151. "shared_with_groups": [],
  152. "request_access_enabled": false
  153. },
  154. {
  155. "id": 6,
  156. "description": "Aspernatur omnis repudiandae qui voluptatibus eaque.",
  157. "default_branch": "master",
  158. "tag_list": [],
  159. "public": false,
  160. "archived": false,
  161. "visibility_level": 10,
  162. "ssh_url_to_repo": "git@gitlab.example.com:twitter/flight.git",
  163. "http_url_to_repo": "https://gitlab.example.com/twitter/flight.git",
  164. "web_url": "https://gitlab.example.com/twitter/flight",
  165. "name": "Flight",
  166. "name_with_namespace": "Twitter / Flight",
  167. "path": "flight",
  168. "path_with_namespace": "twitter/flight",
  169. "issues_enabled": true,
  170. "merge_requests_enabled": true,
  171. "wiki_enabled": true,
  172. "builds_enabled": true,
  173. "snippets_enabled": false,
  174. "container_registry_enabled": true,
  175. "created_at": "2016-06-17T07:47:24.661Z",
  176. "last_activity_at": "2016-06-17T07:47:24.838Z",
  177. "shared_runners_enabled": true,
  178. "creator_id": 1,
  179. "namespace": {
  180. "id": 4,
  181. "name": "Twitter",
  182. "path": "twitter",
  183. "owner_id": null,
  184. "created_at": "2016-06-17T07:47:24.216Z",
  185. "updated_at": "2016-06-17T07:47:24.216Z",
  186. "description": "Aliquid qui quis dignissimos distinctio ut commodi voluptas est.",
  187. "avatar": {
  188. "url": null
  189. },
  190. "share_with_group_lock": false,
  191. "visibility_level": 20
  192. },
  193. "avatar_url": null,
  194. "star_count": 0,
  195. "forks_count": 0,
  196. "open_issues_count": 8,
  197. "public_builds": true,
  198. "shared_with_groups": [],
  199. "request_access_enabled": false
  200. }
  201. ],
  202. "shared_projects": [
  203. {
  204. "id": 8,
  205. "description": "Velit eveniet provident fugiat saepe eligendi autem.",
  206. "default_branch": "master",
  207. "tag_list": [],
  208. "public": false,
  209. "archived": false,
  210. "visibility_level": 0,
  211. "ssh_url_to_repo": "git@gitlab.example.com:h5bp/html5-boilerplate.git",
  212. "http_url_to_repo": "https://gitlab.example.com/h5bp/html5-boilerplate.git",
  213. "web_url": "https://gitlab.example.com/h5bp/html5-boilerplate",
  214. "name": "Html5 Boilerplate",
  215. "name_with_namespace": "H5bp / Html5 Boilerplate",
  216. "path": "html5-boilerplate",
  217. "path_with_namespace": "h5bp/html5-boilerplate",
  218. "issues_enabled": true,
  219. "merge_requests_enabled": true,
  220. "wiki_enabled": true,
  221. "builds_enabled": true,
  222. "snippets_enabled": false,
  223. "container_registry_enabled": true,
  224. "created_at": "2016-06-17T07:47:27.089Z",
  225. "last_activity_at": "2016-06-17T07:47:27.310Z",
  226. "shared_runners_enabled": true,
  227. "creator_id": 1,
  228. "namespace": {
  229. "id": 5,
  230. "name": "H5bp",
  231. "path": "h5bp",
  232. "owner_id": null,
  233. "created_at": "2016-06-17T07:47:26.621Z",
  234. "updated_at": "2016-06-17T07:47:26.621Z",
  235. "description": "Id consequatur rem vel qui doloremque saepe.",
  236. "avatar": {
  237. "url": null
  238. },
  239. "share_with_group_lock": false,
  240. "visibility_level": 20
  241. },
  242. "avatar_url": null,
  243. "star_count": 0,
  244. "forks_count": 0,
  245. "open_issues_count": 4,
  246. "public_builds": true,
  247. "shared_with_groups": [
  248. {
  249. "group_id": 4,
  250. "group_name": "Twitter",
  251. "group_access_level": 30
  252. },
  253. {
  254. "group_id": 3,
  255. "group_name": "Gitlab Org",
  256. "group_access_level": 10
  257. }
  258. ]
  259. }
  260. ]
  261. }
  262. ```
  263. ## New group
  264. Creates a new project group. Available only for users who can create groups.
  265. ```
  266. POST /groups
  267. ```
  268. Parameters:
  269. - `name` (required) - The name of the group
  270. - `path` (required) - The path of the group
  271. - `description` (optional) - The group's description
  272. - `visibility_level` (optional) - The group's visibility. 0 for private, 10 for internal, 20 for public.
  273. - `lfs_enabled` (optional) - Enable/disable Large File Storage (LFS) for the projects in this group
  274. - `request_access_enabled` (optional) - Allow users to request member access.
  275. ## Transfer project to group
  276. Transfer a project to the Group namespace. Available only for admin
  277. ```
  278. POST /groups/:id/projects/:project_id
  279. ```
  280. Parameters:
  281. - `id` (required) - The ID or path of a group
  282. - `project_id` (required) - The ID of a project
  283. ## Update group
  284. Updates the project group. Only available to group owners and administrators.
  285. ```
  286. PUT /groups/:id
  287. ```
  288. | Attribute | Type | Required | Description |
  289. | --------- | ---- | -------- | ----------- |
  290. | `id` | integer | yes | The ID of the group |
  291. | `name` | string | no | The name of the group |
  292. | `path` | string | no | The path of the group |
  293. | `description` | string | no | The description of the group |
  294. | `visibility_level` | integer | no | The visibility level of the group. 0 for private, 10 for internal, 20 for public. |
  295. | `lfs_enabled` (optional) | boolean | no | Enable/disable Large File Storage (LFS) for the projects in this group |
  296. | `request_access_enabled` | boolean | no | Allow users to request member access. |
  297. ```bash
  298. curl --request PUT --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/groups/5?name=Experimental"
  299. ```
  300. Example response:
  301. ```json
  302. {
  303. "id": 5,
  304. "name": "Experimental",
  305. "path": "h5bp",
  306. "description": "foo",
  307. "visibility_level": 10,
  308. "avatar_url": null,
  309. "web_url": "http://gitlab.example.com/groups/h5bp",
  310. "request_access_enabled": false,
  311. "projects": [
  312. {
  313. "id": 9,
  314. "description": "foo",
  315. "default_branch": "master",
  316. "tag_list": [],
  317. "public": false,
  318. "archived": false,
  319. "visibility_level": 10,
  320. "ssh_url_to_repo": "git@gitlab.example.com/html5-boilerplate.git",
  321. "http_url_to_repo": "http://gitlab.example.com/h5bp/html5-boilerplate.git",
  322. "web_url": "http://gitlab.example.com/h5bp/html5-boilerplate",
  323. "name": "Html5 Boilerplate",
  324. "name_with_namespace": "Experimental / Html5 Boilerplate",
  325. "path": "html5-boilerplate",
  326. "path_with_namespace": "h5bp/html5-boilerplate",
  327. "issues_enabled": true,
  328. "merge_requests_enabled": true,
  329. "wiki_enabled": true,
  330. "builds_enabled": true,
  331. "snippets_enabled": true,
  332. "created_at": "2016-04-05T21:40:50.169Z",
  333. "last_activity_at": "2016-04-06T16:52:08.432Z",
  334. "shared_runners_enabled": true,
  335. "creator_id": 1,
  336. "namespace": {
  337. "id": 5,
  338. "name": "Experimental",
  339. "path": "h5bp",
  340. "owner_id": null,
  341. "created_at": "2016-04-05T21:40:49.152Z",
  342. "updated_at": "2016-04-07T08:07:48.466Z",
  343. "description": "foo",
  344. "avatar": {
  345. "url": null
  346. },
  347. "share_with_group_lock": false,
  348. "visibility_level": 10
  349. },
  350. "avatar_url": null,
  351. "star_count": 1,
  352. "forks_count": 0,
  353. "open_issues_count": 3,
  354. "public_builds": true,
  355. "shared_with_groups": [],
  356. "request_access_enabled": false
  357. }
  358. ]
  359. }
  360. ```
  361. ## Remove group
  362. Removes group with all projects inside.
  363. ```
  364. DELETE /groups/:id
  365. ```
  366. Parameters:
  367. - `id` (required) - The ID or path of a user group
  368. ## Search for group
  369. Get all groups that match your string in their name or path.
  370. ```
  371. GET /groups?search=foobar
  372. ```
  373. ```json
  374. [
  375. {
  376. "id": 1,
  377. "name": "Foobar Group",
  378. "path": "foo-bar",
  379. "description": "An interesting group"
  380. }
  381. ]
  382. ```
  383. ## Group members
  384. Please consult the [Group Members](members.md) documentation.
  385. ## Namespaces in groups
  386. By default, groups only get 20 namespaces at a time because the API results are paginated.
  387. To get more (up to 100), pass the following as an argument to the API call:
  388. ```
  389. /groups?per_page=100
  390. ```
  391. And to switch pages add:
  392. ```
  393. /groups?per_page=100&page=2
  394. ```