# Wie fügt man eine Flagge für einen Beitrag in einem Plugin hinzu und entfernt sie

**URL:** https://meta.discourse.org/t/how-to-add-and-remove-a-flag-for-a-post-in-a-plugin/293630
**Category:** Development
**Created:** [31. Januar 2024 um 13:22 UTC](https://meta.discourse.org/t/how-to-add-and-remove-a-flag-for-a-post-in-a-plugin/293630 "2024-01-31T13:22:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![omppatil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omppatil/32/359876_2.png) [@omppatil](https://meta.discourse.org/u/omppatil)
#### Post date: [31. Januar 2024 um 13:22 UTC](https://meta.discourse.org/t/how-to-add-and-remove-a-flag-for-a-post-in-a-plugin/293630/1 "2024-01-31T13:22:14Z")

</div>

Hallo!  
Wie können wir einen Beitrag mit den Discourse-Funktionen markieren und die Markierung des Beitrags auch wieder entfernen?

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [31. Januar 2024 um 17:32 UTC](https://meta.discourse.org/t/how-to-add-and-remove-a-flag-for-a-post-in-a-plugin/293630/2 "2024-01-31T17:32:57Z")

</div>

Hallo,

Ja, das kannst du! Wenn du [Reverse engineer the Discourse API](https://meta.discourse.org/t/reverse-engineer-the-discourse-api/20576) befolgst, kannst du herausfinden, wie es geht.

In deinem Fall ist es eine `POST`-Anfrage an `/post_actions` mit der folgenden möglichen Nutzlast:

| Feld | Beschreibung |
| --- | --- |
| `id` | Die Beitrags-ID |
| `post_action_type_id` | Die Beitragsaktions-ID |
| `message` | Nachricht, die mit den Aktionsarten `notify_user` und `notify_moderators` verwendet wird |
| `is_warning` | Ob du ein Thema markierst |
| `take_action` | Ob du der Markierung zustimmst und den Beitrag sofort ausblendest |
| `queue_for_review` | Ob du sofort zur Überprüfung anstehst |
| `flag_topic` | Ob du ein Thema markierst |

| Aktionstyp | ID |
| --- | --- |
| `off_topic` | 3 |
| `inappropriate` | 4 |
| `spam` | 6 |
| `notify_user` | 7 |
| `notify_moderators` | 8 |

Um eine Markierung zu löschen, kannst du eine `DELETE`-Anfrage an `/post_actions/<post_id>` senden und als Nutzlast `post_action_type_id`.

Ich hoffe, das hilft! 👍

---

<div class="post-metadata">

### Author: ![omppatil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omppatil/32/359876_2.png) [@omppatil](https://meta.discourse.org/u/omppatil)
#### Post date: [1. Februar 2024 um 04:47 UTC](https://meta.discourse.org/t/how-to-add-and-remove-a-flag-for-a-post-in-a-plugin/293630/3 "2024-02-01T04:47:30Z")

</div>

Kann ich es bei der Entwicklung eines Plugins verwenden, und gibt es eine andere Funktion, um dies zu erreichen?
