/doc/api/award_emoji.md

https://gitlab.com/markglenfletcher/gitlab-ce · Markdown · 360 lines · 282 code · 78 blank · 0 comment · 0 complexity · c4a80782e992bf8fee452bfb6e738409 MD5 · raw file

  1. # Award Emoji API
  2. > [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4575) in GitLab 8.9. Snippet support added in 8.12.
  3. An [awarded emoji](../user/award_emojis.md) tells a thousand words.
  4. Emoji can be awarded on the following (known as "awardables"):
  5. - [Issues](../user/project/issues/index.md) ([API](issues.md)).
  6. - [Merge requests](../user/project/merge_requests/index.md) ([API](merge_requests.md)).
  7. - [Snippets](../user/snippets.md) ([API](snippets.md)).
  8. Emoji can also [be awarded](../user/award_emojis.html#award-emoji-for-comments) on comments (also known as notes). See also [Notes API](notes.md).
  9. ## Issues, merge requests, and snippets
  10. See [Award Emoji on Comments](#award-emoji-on-comments) for information on using these endpoints with comments.
  11. ### List an awardable's award emoji
  12. Get a list of all award emoji for a specified awardable.
  13. ```text
  14. GET /projects/:id/issues/:issue_iid/award_emoji
  15. GET /projects/:id/merge_requests/:merge_request_iid/award_emoji
  16. GET /projects/:id/snippets/:snippet_id/award_emoji
  17. ```
  18. Parameters:
  19. | Attribute | Type | Required | Description |
  20. |:---------------|:---------------|:---------|:-----------------------------------------------------------------------------|
  21. | `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding). |
  22. | `issue_iid`/`merge_request_iid`/`snippet_id` | integer | yes | ID (`iid` for merge requests/issues, `id` for snippets) of an awardable. |
  23. Example request:
  24. ```sh
  25. curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/issues/80/award_emoji
  26. ```
  27. Example response:
  28. ```json
  29. [
  30. {
  31. "id": 4,
  32. "name": "1234",
  33. "user": {
  34. "name": "Administrator",
  35. "username": "root",
  36. "id": 1,
  37. "state": "active",
  38. "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
  39. "web_url": "http://gitlab.example.com/root"
  40. },
  41. "created_at": "2016-06-15T10:09:34.206Z",
  42. "updated_at": "2016-06-15T10:09:34.206Z",
  43. "awardable_id": 80,
  44. "awardable_type": "Issue"
  45. },
  46. {
  47. "id": 1,
  48. "name": "microphone",
  49. "user": {
  50. "name": "User 4",
  51. "username": "user4",
  52. "id": 26,
  53. "state": "active",
  54. "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon",
  55. "web_url": "http://gitlab.example.com/user4"
  56. },
  57. "created_at": "2016-06-15T10:09:34.177Z",
  58. "updated_at": "2016-06-15T10:09:34.177Z",
  59. "awardable_id": 80,
  60. "awardable_type": "Issue"
  61. }
  62. ]
  63. ```
  64. ### Get single award emoji
  65. Get a single award emoji from an issue, snippet, or merge request.
  66. ```text
  67. GET /projects/:id/issues/:issue_iid/award_emoji/:award_id
  68. GET /projects/:id/merge_requests/:merge_request_iid/award_emoji/:award_id
  69. GET /projects/:id/snippets/:snippet_id/award_emoji/:award_id
  70. ```
  71. Parameters:
  72. | Attribute | Type | Required | Description |
  73. |:---------------|:---------------|:---------|:-----------------------------------------------------------------------------|
  74. | `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding). |
  75. | `issue_iid`/`merge_request_iid`/`snippet_id` | integer | yes | ID (`iid` for merge requests/issues, `id` for snippets) of an awardable. |
  76. | `award_id` | integer | yes | ID of the award emoji. |
  77. Example request:
  78. ```sh
  79. curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/issues/80/award_emoji/1
  80. ```
  81. Example response:
  82. ```json
  83. {
  84. "id": 1,
  85. "name": "microphone",
  86. "user": {
  87. "name": "User 4",
  88. "username": "user4",
  89. "id": 26,
  90. "state": "active",
  91. "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon",
  92. "web_url": "http://gitlab.example.com/user4"
  93. },
  94. "created_at": "2016-06-15T10:09:34.177Z",
  95. "updated_at": "2016-06-15T10:09:34.177Z",
  96. "awardable_id": 80,
  97. "awardable_type": "Issue"
  98. }
  99. ```
  100. ### Award a new emoji
  101. Create an award emoji on the specified awardable.
  102. ```text
  103. POST /projects/:id/issues/:issue_iid/award_emoji
  104. POST /projects/:id/merge_requests/:merge_request_iid/award_emoji
  105. POST /projects/:id/snippets/:snippet_id/award_emoji
  106. ```
  107. Parameters:
  108. | Attribute | Type | Required | Description |
  109. |:---------------|:---------------|:---------|:-----------------------------------------------------------------------------|
  110. | `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding). |
  111. | `issue_iid`/`merge_request_iid`/`snippet_id` | integer | yes | ID (`iid` for merge requests/issues, `id` for snippets) of an awardable. |
  112. | `name` | string | yes | Name of the emoji without colons. |
  113. ```sh
  114. curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/issues/80/award_emoji?name=blowfish
  115. ```
  116. Example Response:
  117. ```json
  118. {
  119. "id": 344,
  120. "name": "blowfish",
  121. "user": {
  122. "name": "Administrator",
  123. "username": "root",
  124. "id": 1,
  125. "state": "active",
  126. "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
  127. "web_url": "http://gitlab.example.com/root"
  128. },
  129. "created_at": "2016-06-17T17:47:29.266Z",
  130. "updated_at": "2016-06-17T17:47:29.266Z",
  131. "awardable_id": 80,
  132. "awardable_type": "Issue"
  133. }
  134. ```
  135. ### Delete an award emoji
  136. Sometimes it's just not meant to be and you'll have to remove the award.
  137. NOTE: **Note:**
  138. Only available to administrators or the author of the award.
  139. ```text
  140. DELETE /projects/:id/issues/:issue_iid/award_emoji/:award_id
  141. DELETE /projects/:id/merge_requests/:merge_request_iid/award_emoji/:award_id
  142. DELETE /projects/:id/snippets/:snippet_id/award_emoji/:award_id
  143. ```
  144. Parameters:
  145. | Attribute | Type | Required | Description |
  146. |:---------------|:---------------|:---------|:-----------------------------------------------------------------------------|
  147. | `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding). |
  148. | `issue_iid`/`merge_request_iid`/`snippet_id` | integer | yes | ID (`iid` for merge requests/issues, `id` for snippets) of an awardable. |
  149. | `award_id` | integer | yes | ID of an award emoji. |
  150. ```sh
  151. curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/issues/80/award_emoji/344
  152. ```
  153. ## Award Emoji on Comments
  154. Comments (also known as notes) are a sub-resource of issues, merge requests, and snippets.
  155. NOTE: **Note:**
  156. The examples below describe working with award emoji on comments for an issue, but can be
  157. easily adapted for comments on a merge request or on a snippet. Therefore, you have to replace
  158. `issue_iid` either with `merge_request_iid` or with the `snippet_id`.
  159. ### List a comment's award emoji
  160. Get all award emoji for a comment (note).
  161. ```text
  162. GET /projects/:id/issues/:issue_iid/notes/:note_id/award_emoji
  163. ```
  164. Parameters:
  165. | Attribute | Type | Required | Description |
  166. |:------------|:---------------|:---------|:-----------------------------------------------------------------------------|
  167. | `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding). |
  168. | `issue_iid` | integer | yes | Internal ID of an issue. |
  169. | `note_id` | integer | yes | ID of a comment (note). |
  170. Example request:
  171. ```sh
  172. curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/issues/80/notes/1/award_emoji
  173. ```
  174. Example response:
  175. ```json
  176. [
  177. {
  178. "id": 2,
  179. "name": "mood_bubble_lightning",
  180. "user": {
  181. "name": "User 4",
  182. "username": "user4",
  183. "id": 26,
  184. "state": "active",
  185. "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon",
  186. "web_url": "http://gitlab.example.com/user4"
  187. },
  188. "created_at": "2016-06-15T10:09:34.197Z",
  189. "updated_at": "2016-06-15T10:09:34.197Z",
  190. "awardable_id": 1,
  191. "awardable_type": "Note"
  192. }
  193. ]
  194. ```
  195. ### Get an award emoji for a comment
  196. Get a single award emoji for a comment (note).
  197. ```text
  198. GET /projects/:id/issues/:issue_iid/notes/:note_id/award_emoji/:award_id
  199. ```
  200. Parameters:
  201. | Attribute | Type | Required | Description |
  202. |:------------|:---------------|:---------|:-----------------------------------------------------------------------------|
  203. | `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding). |
  204. | `issue_iid` | integer | yes | Internal ID of an issue. |
  205. | `note_id` | integer | yes | ID of a comment (note). |
  206. | `award_id` | integer | yes | ID of the award emoji. |
  207. Example request:
  208. ```sh
  209. curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/issues/80/notes/1/award_emoji/2
  210. ```
  211. Example response:
  212. ```json
  213. {
  214. "id": 2,
  215. "name": "mood_bubble_lightning",
  216. "user": {
  217. "name": "User 4",
  218. "username": "user4",
  219. "id": 26,
  220. "state": "active",
  221. "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon",
  222. "web_url": "http://gitlab.example.com/user4"
  223. },
  224. "created_at": "2016-06-15T10:09:34.197Z",
  225. "updated_at": "2016-06-15T10:09:34.197Z",
  226. "awardable_id": 1,
  227. "awardable_type": "Note"
  228. }
  229. ```
  230. ### Award a new emoji on a comment
  231. Create an award emoji on the specified comment (note).
  232. ```text
  233. POST /projects/:id/issues/:issue_iid/notes/:note_id/award_emoji
  234. ```
  235. Parameters:
  236. | Attribute | Type | Required | Description |
  237. |:------------|:---------------|:---------|:-----------------------------------------------------------------------------|
  238. | `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding). |
  239. | `issue_iid` | integer | yes | Internal ID of an issue. |
  240. | `note_id` | integer | yes | ID of a comment (note). |
  241. | `name` | string | yes | Name of the emoji without colons. |
  242. Example request:
  243. ```sh
  244. curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/issues/80/notes/1/award_emoji?name=rocket
  245. ```
  246. Example response:
  247. ```json
  248. {
  249. "id": 345,
  250. "name": "rocket",
  251. "user": {
  252. "name": "Administrator",
  253. "username": "root",
  254. "id": 1,
  255. "state": "active",
  256. "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
  257. "web_url": "http://gitlab.example.com/root"
  258. },
  259. "created_at": "2016-06-17T19:59:55.888Z",
  260. "updated_at": "2016-06-17T19:59:55.888Z",
  261. "awardable_id": 1,
  262. "awardable_type": "Note"
  263. }
  264. ```
  265. ### Delete an award emoji from a comment
  266. Sometimes it's just not meant to be and you'll have to remove the award.
  267. NOTE: **Note:**
  268. Only available to administrators or the author of the award.
  269. ```text
  270. DELETE /projects/:id/issues/:issue_iid/notes/:note_id/award_emoji/:award_id
  271. ```
  272. Parameters:
  273. | Attribute | Type | Required | Description |
  274. |:------------|:---------------|:---------|:-----------------------------------------------------------------------------|
  275. | `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding). |
  276. | `issue_iid` | integer | yes | Internal ID of an issue. |
  277. | `note_id` | integer | yes | ID of a comment (note). |
  278. | `award_id` | integer | yes | ID of an award_emoji. |
  279. Example request:
  280. ```sh
  281. curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/issues/80/award_emoji/345
  282. ```