# 如何通过 Discourse API 创建包含内容的主题？

**URL:** https://meta.discourse.org/t/how-can-i-create-a-topic-with-content-via-the-discourse-api/101319
**Category:** Development
**Created:** [2018年十一月5日 16:28 UTC](https://meta.discourse.org/t/how-can-i-create-a-topic-with-content-via-the-discourse-api/101319 "2018-11-05T16:28:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![SebastianADW](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@SebastianADW](https://meta.discourse.org/u/SebastianADW)
#### Post date: [2018年十一月5日 16:28 UTC](https://meta.discourse.org/t/how-can-i-create-a-topic-with-content-via-the-discourse-api/101319/1 "2018-11-05T16:28:01Z")

</div>

So what i basically want to do is to run a Ruby File which creates a Topic with content to my Discourse server.

First of all just to learn how to use the Discourse API. I want to develop a plugin that writes content to a certain topic every few minutes. But i dont really know how to start.

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [2018年十一月5日 17:04 UTC](https://meta.discourse.org/t/how-can-i-create-a-topic-with-content-via-the-discourse-api/101319/2 "2018-11-05T17:04:55Z")

</div>

There are some [examples](https://github.com/discourse/discourse_api/tree/master/examples) of using the ruby discourse\_api gem inside of the repo. I would start with [this one](https://github.com/discourse/discourse_api/blob/master/examples/create_topic.rb).

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2018年十一月6日 11:01 UTC](https://meta.discourse.org/t/how-can-i-create-a-topic-with-content-via-the-discourse-api/101319/3 "2018-11-06T11:01:03Z")

</div>

Using the api and developing a plugin are very different. Is your goal is to develop a plugin you might start with the plugin tutorial.
