# Posting to sub category not working for me

**URL:** https://meta.discourse.org/t/posting-to-sub-category-not-working-for-me/63462
**Category:** Support
**Created:** [May 26, 2017, 11:19pm UTC](https://meta.discourse.org/t/posting-to-sub-category-not-working-for-me/63462 "2017-05-26T23:19:00Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Michael\_Fomin](https://avatars.discourse-cdn.com/v4/letter/m/df705f/32.png) [@Michael\_Fomin](https://meta.discourse.org/u/Michael_Fomin)
#### Post date: [May 26, 2017, 11:19pm UTC](https://meta.discourse.org/t/posting-to-sub-category-not-working-for-me/63462/1 "2017-05-26T23:19:00Z")

</div>

Hi,

Using the following curl command to post to our forum from bash

`curl -X POST -H "Content-Type: application/json" --data @/tmp/json.json "https://my.forum/posts?api_key=$API_KEY&api_username=$UN"`

where json.json contains…

```plaintext
{
 "title": "test post",
 "category": "cat/subcat",
 "raw": "test post"
}

```

This works fine when sending to just a category, but when I try to send to a sub category, as shown above, the post is created without a category, so that everyone on the forum appears to see it

Anything special I need to set to get the post to correct be sent to a sub category

---

<div class="post-metadata">

### Author: ![DeanMarkTaylor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deanmarktaylor/32/102462_2.png) [@DeanMarkTaylor](https://meta.discourse.org/u/DeanMarkTaylor)
#### Post date: [May 27, 2017, 12:42am UTC](https://meta.discourse.org/t/posting-to-sub-category-not-working-for-me/63462/2 "2017-05-27T00:42:19Z")

</div>

It’s best to use the category ID integer value as indicated by the docs here:

> **[Discourse API Docs](https://docs.discourse.org/#tag/Topics%2Fpaths%2F~1posts%2Fpost)**

This is untested by me but I believe you can also use the “subcat” without the prefix “cat/” however there may be some issue if you have categories / subcategories with the same names.

I would stick with integer category ID numbers.

---

<div class="post-metadata">

### Author: ![Michael\_Fomin](https://avatars.discourse-cdn.com/v4/letter/m/df705f/32.png) [@Michael\_Fomin](https://meta.discourse.org/u/Michael_Fomin)
#### Post date: [June 2, 2017, 10:35pm UTC](https://meta.discourse.org/t/posting-to-sub-category-not-working-for-me/63462/3 "2017-06-02T22:35:14Z")

</div>

Thanks, using the category ID numbers worked 🙂

---

<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: [June 13, 2019, 5:53pm UTC](https://meta.discourse.org/t/posting-to-sub-category-not-working-for-me/63462/4 "2019-06-13T17:53:54Z")

</div>



---

<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: [July 13, 2019, 5:54pm UTC](https://meta.discourse.org/t/posting-to-sub-category-not-working-for-me/63462/5 "2019-07-13T17:54:01Z")

</div>

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