debian-mirror-gitlab/doc/api/award_emoji.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

378 lines
14 KiB
Markdown
Raw Normal View History

2020-06-23 00:09:42 +05:30
---
stage: Plan
group: Project Management
2022-11-25 23:54:43 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2020-06-23 00:09:42 +05:30
---
2023-07-09 08:55:56 +05:30
# Emoji reactions API **(FREE)**
2016-09-29 09:46:39 +05:30
2023-07-09 08:55:56 +05:30
> [Renamed](https://gitlab.com/gitlab-org/gitlab/-/issues/409884) from "award emojis" to "emoji reactions" in GitLab 16.0.
2016-06-22 15:30:34 +05:30
2023-07-09 08:55:56 +05:30
An [emoji reaction](../user/award_emojis.md) tells a thousand words.
We call GitLab objects on which you can react with an emoji "awardables".
You can react with emojis on the following:
2019-03-02 22:35:43 +05:30
2021-11-11 11:23:49 +05:30
- [Epics](../user/group/epics/index.md) ([API](epics.md)). **(PREMIUM)**
2019-03-02 22:35:43 +05:30
- [Issues](../user/project/issues/index.md) ([API](issues.md)).
- [Merge requests](../user/project/merge_requests/index.md) ([API](merge_requests.md)).
- [Snippets](../user/snippets.md) ([API](snippets.md)).
2023-07-09 08:55:56 +05:30
- [Comments](../user/award_emojis.md#emoji-reactions-for-comments) ([API](notes.md)).
2016-06-22 15:30:34 +05:30
2016-09-29 09:46:39 +05:30
## Issues, merge requests, and snippets
2016-06-22 15:30:34 +05:30
2023-07-09 08:55:56 +05:30
For information on using these endpoints with comments, see [Add reactions to comments](#add-reactions-to-comments).
2019-03-02 22:35:43 +05:30
2023-07-09 08:55:56 +05:30
### List an awardable's emoji reactions
2016-06-22 15:30:34 +05:30
2022-08-13 15:12:31 +05:30
> [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/335068) in GitLab 15.1 to allow unauthenticated access to public awardables.
2023-07-09 08:55:56 +05:30
Get a list of all emoji reactions for a specified awardable. This endpoint can
2022-08-13 15:12:31 +05:30
be accessed without authentication if the awardable is publicly accessible.
2016-06-22 15:30:34 +05:30
2020-05-24 23:13:21 +05:30
```plaintext
2017-08-17 22:00:37 +05:30
GET /projects/:id/issues/:issue_iid/award_emoji
GET /projects/:id/merge_requests/:merge_request_iid/award_emoji
2016-09-29 09:46:39 +05:30
GET /projects/:id/snippets/:snippet_id/award_emoji
2016-06-22 15:30:34 +05:30
```
Parameters:
2019-03-02 22:35:43 +05:30
| Attribute | Type | Required | Description |
|:---------------|:---------------|:---------|:-----------------------------------------------------------------------------|
2023-04-23 21:23:45 +05:30
| `id` | integer/string | yes | ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding). |
2019-07-07 11:18:12 +05:30
| `issue_iid`/`merge_request_iid`/`snippet_id` | integer | yes | ID (`iid` for merge requests/issues, `id` for snippets) of an awardable. |
2016-06-22 15:30:34 +05:30
2019-03-02 22:35:43 +05:30
Example request:
2020-03-13 15:44:24 +05:30
```shell
2020-06-23 00:09:42 +05:30
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/issues/80/award_emoji"
2016-06-22 15:30:34 +05:30
```
2019-03-02 22:35:43 +05:30
Example response:
2016-06-22 15:30:34 +05:30
```json
[
{
"id": 4,
"name": "1234",
"user": {
"name": "Administrator",
"username": "root",
"id": 1,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
2016-11-03 12:29:30 +05:30
"web_url": "http://gitlab.example.com/root"
2016-06-22 15:30:34 +05:30
},
"created_at": "2016-06-15T10:09:34.206Z",
"updated_at": "2016-06-15T10:09:34.206Z",
"awardable_id": 80,
"awardable_type": "Issue"
},
{
"id": 1,
"name": "microphone",
"user": {
"name": "User 4",
"username": "user4",
"id": 26,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon",
2016-11-03 12:29:30 +05:30
"web_url": "http://gitlab.example.com/user4"
2016-06-22 15:30:34 +05:30
},
"created_at": "2016-06-15T10:09:34.177Z",
"updated_at": "2016-06-15T10:09:34.177Z",
"awardable_id": 80,
"awardable_type": "Issue"
}
]
```
2023-07-09 08:55:56 +05:30
### Get single emoji reaction
2016-06-22 15:30:34 +05:30
2022-08-13 15:12:31 +05:30
> [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/335068) in GitLab 15.1 to allow unauthenticated access to public awardables.
2023-07-09 08:55:56 +05:30
Get a single emoji reaction from an issue, snippet, or merge request. This endpoint can
2022-08-13 15:12:31 +05:30
be accessed without authentication if the awardable is publicly accessible.
2016-06-22 15:30:34 +05:30
2020-05-24 23:13:21 +05:30
```plaintext
2017-08-17 22:00:37 +05:30
GET /projects/:id/issues/:issue_iid/award_emoji/:award_id
GET /projects/:id/merge_requests/:merge_request_iid/award_emoji/:award_id
2016-09-29 09:46:39 +05:30
GET /projects/:id/snippets/:snippet_id/award_emoji/:award_id
2016-06-22 15:30:34 +05:30
```
Parameters:
2019-03-02 22:35:43 +05:30
| Attribute | Type | Required | Description |
|:---------------|:---------------|:---------|:-----------------------------------------------------------------------------|
2023-04-23 21:23:45 +05:30
| `id` | integer/string | yes | ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding). |
2019-07-07 11:18:12 +05:30
| `issue_iid`/`merge_request_iid`/`snippet_id` | integer | yes | ID (`iid` for merge requests/issues, `id` for snippets) of an awardable. |
2023-07-09 08:55:56 +05:30
| `award_id` | integer | yes | ID of the emoji reaction. |
2019-03-02 22:35:43 +05:30
Example request:
2016-06-22 15:30:34 +05:30
2020-03-13 15:44:24 +05:30
```shell
2020-06-23 00:09:42 +05:30
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/issues/80/award_emoji/1"
2016-06-22 15:30:34 +05:30
```
2019-03-02 22:35:43 +05:30
Example response:
2016-06-22 15:30:34 +05:30
```json
{
"id": 1,
"name": "microphone",
"user": {
"name": "User 4",
"username": "user4",
"id": 26,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon",
2016-11-03 12:29:30 +05:30
"web_url": "http://gitlab.example.com/user4"
2016-06-22 15:30:34 +05:30
},
"created_at": "2016-06-15T10:09:34.177Z",
"updated_at": "2016-06-15T10:09:34.177Z",
"awardable_id": 80,
"awardable_type": "Issue"
}
```
2023-07-09 08:55:56 +05:30
### Add a new emoji reaction
2016-06-22 15:30:34 +05:30
2023-07-09 08:55:56 +05:30
Add an emoji reaction on the specified awardable.
2016-06-22 15:30:34 +05:30
2020-05-24 23:13:21 +05:30
```plaintext
2017-08-17 22:00:37 +05:30
POST /projects/:id/issues/:issue_iid/award_emoji
POST /projects/:id/merge_requests/:merge_request_iid/award_emoji
2016-09-29 09:46:39 +05:30
POST /projects/:id/snippets/:snippet_id/award_emoji
2016-06-22 15:30:34 +05:30
```
Parameters:
2019-03-02 22:35:43 +05:30
| Attribute | Type | Required | Description |
|:---------------|:---------------|:---------|:-----------------------------------------------------------------------------|
2023-04-23 21:23:45 +05:30
| `id` | integer/string | yes | ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding). |
2019-07-07 11:18:12 +05:30
| `issue_iid`/`merge_request_iid`/`snippet_id` | integer | yes | ID (`iid` for merge requests/issues, `id` for snippets) of an awardable. |
2019-03-02 22:35:43 +05:30
| `name` | string | yes | Name of the emoji without colons. |
2016-06-22 15:30:34 +05:30
2020-03-13 15:44:24 +05:30
```shell
2020-06-23 00:09:42 +05:30
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/issues/80/award_emoji?name=blowfish"
2016-06-22 15:30:34 +05:30
```
Example Response:
```json
{
"id": 344,
"name": "blowfish",
"user": {
"name": "Administrator",
"username": "root",
"id": 1,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
2016-11-03 12:29:30 +05:30
"web_url": "http://gitlab.example.com/root"
2016-06-22 15:30:34 +05:30
},
"created_at": "2016-06-17T17:47:29.266Z",
"updated_at": "2016-06-17T17:47:29.266Z",
"awardable_id": 80,
"awardable_type": "Issue"
2017-08-17 22:00:37 +05:30
}
2016-06-22 15:30:34 +05:30
```
2023-07-09 08:55:56 +05:30
### Delete an emoji reaction
2016-06-22 15:30:34 +05:30
2023-07-09 08:55:56 +05:30
Sometimes it's just not meant to be and you need to remove your reaction.
2016-06-22 15:30:34 +05:30
2023-07-09 08:55:56 +05:30
Only an administrator or the author of the reaction can delete an emoji reaction.
2019-03-02 22:35:43 +05:30
2020-05-24 23:13:21 +05:30
```plaintext
2017-08-17 22:00:37 +05:30
DELETE /projects/:id/issues/:issue_iid/award_emoji/:award_id
DELETE /projects/:id/merge_requests/:merge_request_iid/award_emoji/:award_id
2016-09-29 09:46:39 +05:30
DELETE /projects/:id/snippets/:snippet_id/award_emoji/:award_id
2016-06-22 15:30:34 +05:30
```
Parameters:
2019-03-02 22:35:43 +05:30
| Attribute | Type | Required | Description |
|:---------------|:---------------|:---------|:-----------------------------------------------------------------------------|
2023-04-23 21:23:45 +05:30
| `id` | integer/string | yes | ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding). |
2019-07-07 11:18:12 +05:30
| `issue_iid`/`merge_request_iid`/`snippet_id` | integer | yes | ID (`iid` for merge requests/issues, `id` for snippets) of an awardable. |
2023-07-09 08:55:56 +05:30
| `award_id` | integer | yes | ID of an emoji reaction. |
2016-06-22 15:30:34 +05:30
2020-03-13 15:44:24 +05:30
```shell
2020-06-23 00:09:42 +05:30
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/issues/80/award_emoji/344"
2016-06-22 15:30:34 +05:30
```
2023-07-09 08:55:56 +05:30
## Add reactions to comments
2016-06-22 15:30:34 +05:30
2019-03-02 22:35:43 +05:30
Comments (also known as notes) are a sub-resource of issues, merge requests, and snippets.
2016-06-22 15:30:34 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2023-07-09 08:55:56 +05:30
The examples below describe working with emoji reactions on an issue's comments, but can be
2021-02-22 17:27:13 +05:30
adapted to comments on merge requests and snippets. Therefore, you have to replace
2019-07-07 11:18:12 +05:30
`issue_iid` either with `merge_request_iid` or with the `snippet_id`.
2016-06-22 15:30:34 +05:30
2023-07-09 08:55:56 +05:30
### List a comment's emoji reactions
2019-03-02 22:35:43 +05:30
2022-08-13 15:12:31 +05:30
> [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/335068) in GitLab 15.1 to allow unauthenticated access to public comments.
2023-07-09 08:55:56 +05:30
Get all emoji reactions for a comment (note). This endpoint can
2022-08-13 15:12:31 +05:30
be accessed without authentication if the comment is publicly accessible.
2019-03-02 22:35:43 +05:30
2020-05-24 23:13:21 +05:30
```plaintext
2017-08-17 22:00:37 +05:30
GET /projects/:id/issues/:issue_iid/notes/:note_id/award_emoji
2016-06-22 15:30:34 +05:30
```
Parameters:
2019-03-02 22:35:43 +05:30
| Attribute | Type | Required | Description |
|:------------|:---------------|:---------|:-----------------------------------------------------------------------------|
2023-04-23 21:23:45 +05:30
| `id` | integer/string | yes | ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding). |
2019-03-02 22:35:43 +05:30
| `issue_iid` | integer | yes | Internal ID of an issue. |
| `note_id` | integer | yes | ID of a comment (note). |
2016-06-22 15:30:34 +05:30
2019-03-02 22:35:43 +05:30
Example request:
2016-06-22 15:30:34 +05:30
2020-03-13 15:44:24 +05:30
```shell
2020-06-23 00:09:42 +05:30
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/issues/80/notes/1/award_emoji"
2016-06-22 15:30:34 +05:30
```
2019-03-02 22:35:43 +05:30
Example response:
2016-06-22 15:30:34 +05:30
```json
[
{
"id": 2,
"name": "mood_bubble_lightning",
"user": {
"name": "User 4",
"username": "user4",
"id": 26,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon",
2016-11-03 12:29:30 +05:30
"web_url": "http://gitlab.example.com/user4"
2016-06-22 15:30:34 +05:30
},
"created_at": "2016-06-15T10:09:34.197Z",
"updated_at": "2016-06-15T10:09:34.197Z",
"awardable_id": 1,
"awardable_type": "Note"
}
]
```
2023-07-09 08:55:56 +05:30
### Get an emoji reaction for a comment
2016-06-22 15:30:34 +05:30
2022-08-13 15:12:31 +05:30
> [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/335068) in GitLab 15.1 to allow unauthenticated access to public comments.
2023-07-09 08:55:56 +05:30
Get a single emoji reaction for a comment (note). This endpoint can
2022-08-13 15:12:31 +05:30
be accessed without authentication if the comment is publicly accessible.
2019-03-02 22:35:43 +05:30
2020-05-24 23:13:21 +05:30
```plaintext
2017-08-17 22:00:37 +05:30
GET /projects/:id/issues/:issue_iid/notes/:note_id/award_emoji/:award_id
2016-06-22 15:30:34 +05:30
```
Parameters:
2019-03-02 22:35:43 +05:30
| Attribute | Type | Required | Description |
|:------------|:---------------|:---------|:-----------------------------------------------------------------------------|
2023-04-23 21:23:45 +05:30
| `id` | integer/string | yes | ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding). |
2019-03-02 22:35:43 +05:30
| `issue_iid` | integer | yes | Internal ID of an issue. |
| `note_id` | integer | yes | ID of a comment (note). |
2023-07-09 08:55:56 +05:30
| `award_id` | integer | yes | ID of the emoji reaction. |
2019-03-02 22:35:43 +05:30
Example request:
2016-06-22 15:30:34 +05:30
2020-03-13 15:44:24 +05:30
```shell
2020-06-23 00:09:42 +05:30
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/issues/80/notes/1/award_emoji/2"
2016-06-22 15:30:34 +05:30
```
2019-03-02 22:35:43 +05:30
Example response:
2016-06-22 15:30:34 +05:30
```json
{
"id": 2,
"name": "mood_bubble_lightning",
"user": {
"name": "User 4",
"username": "user4",
"id": 26,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon",
2016-11-03 12:29:30 +05:30
"web_url": "http://gitlab.example.com/user4"
2016-06-22 15:30:34 +05:30
},
"created_at": "2016-06-15T10:09:34.197Z",
"updated_at": "2016-06-15T10:09:34.197Z",
"awardable_id": 1,
"awardable_type": "Note"
}
```
2019-03-02 22:35:43 +05:30
### Award a new emoji on a comment
2016-06-22 15:30:34 +05:30
2023-07-09 08:55:56 +05:30
Create an emoji reaction on the specified comment (note).
2019-03-02 22:35:43 +05:30
2020-05-24 23:13:21 +05:30
```plaintext
2017-08-17 22:00:37 +05:30
POST /projects/:id/issues/:issue_iid/notes/:note_id/award_emoji
2016-06-22 15:30:34 +05:30
```
Parameters:
2019-03-02 22:35:43 +05:30
| Attribute | Type | Required | Description |
|:------------|:---------------|:---------|:-----------------------------------------------------------------------------|
2023-04-23 21:23:45 +05:30
| `id` | integer/string | yes | ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding). |
2019-03-02 22:35:43 +05:30
| `issue_iid` | integer | yes | Internal ID of an issue. |
| `note_id` | integer | yes | ID of a comment (note). |
| `name` | string | yes | Name of the emoji without colons. |
2016-06-22 15:30:34 +05:30
2019-03-02 22:35:43 +05:30
Example request:
2020-03-13 15:44:24 +05:30
```shell
2020-06-23 00:09:42 +05:30
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"
2016-06-22 15:30:34 +05:30
```
2019-03-02 22:35:43 +05:30
Example response:
2016-06-22 15:30:34 +05:30
```json
{
"id": 345,
"name": "rocket",
"user": {
"name": "Administrator",
"username": "root",
"id": 1,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
2016-11-03 12:29:30 +05:30
"web_url": "http://gitlab.example.com/root"
2016-06-22 15:30:34 +05:30
},
"created_at": "2016-06-17T19:59:55.888Z",
"updated_at": "2016-06-17T19:59:55.888Z",
"awardable_id": 1,
"awardable_type": "Note"
}
```
2023-07-09 08:55:56 +05:30
### Delete an emoji reaction from a comment
2016-06-22 15:30:34 +05:30
2023-07-09 08:55:56 +05:30
Sometimes it's just not meant to be and you need to remove the reaction.
2016-06-22 15:30:34 +05:30
2023-07-09 08:55:56 +05:30
Only an administrator or the author of the reaction can delete an emoji reaction.
2019-03-02 22:35:43 +05:30
2020-05-24 23:13:21 +05:30
```plaintext
2017-08-17 22:00:37 +05:30
DELETE /projects/:id/issues/:issue_iid/notes/:note_id/award_emoji/:award_id
2016-06-22 15:30:34 +05:30
```
Parameters:
2019-03-02 22:35:43 +05:30
| Attribute | Type | Required | Description |
|:------------|:---------------|:---------|:-----------------------------------------------------------------------------|
2023-04-23 21:23:45 +05:30
| `id` | integer/string | yes | ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding). |
2019-03-02 22:35:43 +05:30
| `issue_iid` | integer | yes | Internal ID of an issue. |
| `note_id` | integer | yes | ID of a comment (note). |
2023-07-09 08:55:56 +05:30
| `award_id` | integer | yes | ID of an emoji reaction. |
2019-03-02 22:35:43 +05:30
Example request:
2016-06-22 15:30:34 +05:30
2020-03-13 15:44:24 +05:30
```shell
2020-06-23 00:09:42 +05:30
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/issues/80/award_emoji/345"
2016-06-22 15:30:34 +05:30
```