# Discourse API Gem - 如何使用标签创建主题？

**URL:** <https://meta.discourse.org/t/discourse-api-gem-how-to-create-topic-with-tags/156869>\
**Category:** Support\
**Created:** [2020年七月6日 03:31 UTC](https://meta.discourse.org/t/discourse-api-gem-how-to-create-topic-with-tags/156869 "2020-07-06T03:31:54Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![AstonJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/astonj/32/215041_2.png) [@AstonJ](https://meta.discourse.org/u/AstonJ)\
**Post date:** [2020年七月6日 15:11 UTC](https://meta.discourse.org/t/discourse-api-gem-how-to-create-topic-with-tags/156869/3 "2020-07-06T15:11:40Z")

</div>

Faizaan，这也行不通（同样是提示需要标签的错误信息）。

不确定这是否已过时，但看起来标签与其他字段不同，属于某种数组类型——那么我们该如何通过 gem 来使用它呢？

> [@Can't create topic with tag using admin API due to insufficient trust level](https://meta.discourse.org/t/cant-create-topic-with-tag-using-admin-api-due-to-insufficient-trust-level/46972/4?u=astonj):
>
> This worked for me and added two tags: curl --data "api\_key=asdf...asdf&api\_username=neill&title=this%20one%20has%20two%20tags&raw=and%20it%20is%20twice%20as%20delicious&tags[]=mazda&tags[]=protege" http://localhost:3000/posts.json [image] So I’m not sure why it isn’t working for you…

---

_[View the full topic](https://meta.discourse.org/t/discourse-api-gem-how-to-create-topic-with-tags/156869)._
