# Always get Error 500 when try to create category

**URL:** https://meta.discourse.org/t/always-get-error-500-when-try-to-create-category/137296
**Category:** Support
**Created:** [29 december 2019 om 10:26 UTC](https://meta.discourse.org/t/always-get-error-500-when-try-to-create-category/137296 "2019-12-29T10:26:32Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![paultaylor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paultaylor/32/166024_2.png) [@paultaylor](https://meta.discourse.org/u/paultaylor)
#### Post date: [29 december 2019 om 10:26 UTC](https://meta.discourse.org/t/always-get-error-500-when-try-to-create-category/137296/1 "2019-12-29T10:26:32Z")

</div>

Im trying to create a category using Api, always fails with Error 500 for both

```
curl -s -X POST --data "name=Fred&color=0xffffff&text_color==0xbbbbbb&api_key=*API_USER_KEY*&api_username=*USER_NAME*" https://community.jthink.net/categories

```

and

```
curl -s -X POST --data "name=Fred&color=0xffffff&text_color==0xbbbbbb&api_key=*API_USER_KEY*&api_username=*USER_NAME*" https://community.jthink.net/categories.json

```

and when called with java code.

My api key etc are okay, and I can get creating user via api to work okay.

What am I doing wrong ?

---

<div class="post-metadata">

### Author: ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)
#### Post date: [29 december 2019 om 10:29 UTC](https://meta.discourse.org/t/always-get-error-500-when-try-to-create-category/137296/2 "2019-12-29T10:29:35Z")

</div>

Is the text color parameter supposed to have the double == symbol?

---

<div class="post-metadata">

### Author: ![paultaylor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paultaylor/32/166024_2.png) [@paultaylor](https://meta.discourse.org/u/paultaylor)
#### Post date: [29 december 2019 om 10:32 UTC](https://meta.discourse.org/t/always-get-error-500-when-try-to-create-category/137296/3 "2019-12-29T10:32:11Z")

</div>

Right thankyou, okay that fixes curl, unfortunately that works but doesnt explain Java issue, I was only using curl to try and work out what the Java issue was.

---

<div class="post-metadata">

### Author: ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)
#### Post date: [29 december 2019 om 10:33 UTC](https://meta.discourse.org/t/always-get-error-500-when-try-to-create-category/137296/4 "2019-12-29T10:33:22Z")

</div>

You didn’t explain what you’re doing in Java, so that’s impossible to answer.. (also, I don’t know Java so I wouldn’t be able to help you with that anyway, sorry 🙂 )

---

<div class="post-metadata">

### Author: ![paultaylor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paultaylor/32/166024_2.png) [@paultaylor](https://meta.discourse.org/u/paultaylor)
#### Post date: [29 december 2019 om 10:40 UTC](https://meta.discourse.org/t/always-get-error-500-when-try-to-create-category/137296/5 "2019-12-29T10:40:13Z")

</div>

That is true, well Im trying to do the same thing as curl, now at least I know the api does work as expected I will look at my code again to see if silly error in there.

I do have a couple if questions about the categories api though that you may be able to help with:

1. Are there extra fields not shown in the api docs you can pass to the api when you create categories (such as category description) or not ?  
2, what are sensible values for color and text-color, is there some kind of defacto standard for assigning colors to different types of categories ?

---

<div class="post-metadata">

### Author: ![paultaylor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paultaylor/32/166024_2.png) [@paultaylor](https://meta.discourse.org/u/paultaylor)
#### Post date: [6 januari 2020 om 13:34 UTC](https://meta.discourse.org/t/always-get-error-500-when-try-to-create-category/137296/6 "2020-01-06T13:34:53Z")

</div>

Eventually found the issue, I was passing the colors wrong in my json, passing **0x** 24aae2 instead of 24aae2

---

<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: [5 februari 2020 om 13:35 UTC](https://meta.discourse.org/t/always-get-error-500-when-try-to-create-category/137296/7 "2020-02-05T13:35:17Z")

</div>

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