# 我可以在 Discourse API 中选择标签/回复吗？

**URL:** https://meta.discourse.org/t/can-i-select-tag-reply-through-discourse-api/176587
**Category:** Development
**Tags:** rest-api
**Created:** [2021年一月19日 17:33 UTC](https://meta.discourse.org/t/can-i-select-tag-reply-through-discourse-api/176587 "2021-01-19T17:33:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Flashio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/flashio/32/148951_2.png) [@Flashio](https://meta.discourse.org/u/Flashio)
#### Post date: [2021年一月19日 17:33 UTC](https://meta.discourse.org/t/can-i-select-tag-reply-through-discourse-api/176587/1 "2021-01-19T17:33:05Z")

</div>

我在文档中没有找到这些内容，但我可以：

1. 在调用 Discourse API 创建新主题时，选择主题标签吗？
2. 使用 Discourse API 回复已创建的主题吗？

谢谢。

---

<div class="post-metadata">

### Author: ![renato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renato/32/383632_2.png) [@renato](https://meta.discourse.org/u/renato)
#### Post date: [2021年一月19日 20:47 UTC](https://meta.discourse.org/t/can-i-select-tag-reply-through-discourse-api/176587/5 "2021-01-19T20:47:52Z")

</div>

> [@Flashio](#):
>
> - 在使用 Discourse API 请求创建新主题时，如何选择主题标签？

在 HTTP POST 时将 `tags` 设置为字符串数组。例如：

```json
{
  title: "主题标题",
  raw: "原始内容",
  category: 1,
  tags: ["标签1", "标签2"]
}

```

> [@Flashio](#):
>
> 1. 如何使用 Discourse API 回复已创建的主题？

创建主题时使用的 `/posts.json` 端点同样可用于回复，只需设置 `topic_id`。更多信息请参见 [Discourse API Docs](https://docs.discourse.org/#tag/Posts/paths/~1posts.json/post%E3%80%82)

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2023年四月4日 15:35 UTC](https://meta.discourse.org/t/can-i-select-tag-reply-through-discourse-api/176587/6 "2023-04-04T15:35:59Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
