# 为话题添加标签

**URL:** https://meta.discourse.org/t/add-tag-to-the-topic/157345
**Category:** Development
**Tags:** rest-api
**Created:** [2020年七月10日 11:06 UTC](https://meta.discourse.org/t/add-tag-to-the-topic/157345 "2020-07-10T11:06:39Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Minhaj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/minhaj/32/137595_2.png) [@Minhaj](https://meta.discourse.org/u/Minhaj)
#### Post date: [2020年七月10日 11:06 UTC](https://meta.discourse.org/t/add-tag-to-the-topic/157345/1 "2020-07-10T11:06:39Z")

</div>

我想查询 tag\_groups 并从其中为一个通过 Discourse API 创建的主题分配一个标签。我在 API 文档中找不到相关信息，能否有人指点一下？

---

<div class="post-metadata">

### Author: ![osioke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osioke/32/238946_2.png) [@osioke](https://meta.discourse.org/u/osioke)
#### Post date: [2020年七月10日 11:08 UTC](https://meta.discourse.org/t/add-tag-to-the-topic/157345/2 "2020-07-10T11:08:11Z")

</div>

如果在 API 文档中找不到相关内容，您将需要逆向工程分析 API，请参阅此处：

> [@Reverse engineer the Discourse API](https://meta.discourse.org/t/how-to-reverse-engineer-the-discourse-api/20576):
>
> Discourse is backed by a complete JSON api. Anything you can do on the site you can also do using the JSON api. The API is documented at [docs.discourse.org](https://docs.discourse.org). You can also use the [discourse\_api](https://github.com/discourse/discourse_api) Ruby gem as a client library. However, not every endpoint is documented. To determine how to do something with the JSON API here are some steps you can follow. Example: recategorize a topic. Go to a topic and start editing a category: Open Chrome dev tools, switch to the Network tab, select …
