Problem creating a category using the API


I have successfully created a topic using the API (using entry point posts, as described here), which makes me think my process is good.

But when I try to create a category (using entry point categories.json, as documented here, or entry point categories, as sniffed under Chrome using this method, or even entry point create_category, as it seems to be used here), I get the following error:

Error: failed [400] <!DOCTYPE html> <html lang="en"> <head>   <meta charset="utf-8" />   <title>Action Controller: Exception caught</ti
tle>   <style>     body {       background-color: #FAFAFA;       color: #333;       margin: 0px;     }      body, p, ol, ul, td {       font-family: helvetica, ve
rdana, arial, sans-serif;       font-size:   13px;       line-height: 18px;     }      pre {       font-size: 11px;       white-space: pre-wrap;     }
x {       border: 1px solid #EEE;       p

(followed by a dozen pages of css/html gibberish)

Any idea what I’m doing wrong?

(Blake Erickson) #2

I’m not sure, can you send me your actual post request. Feel free to obfuscate your api key.

I’m able to create a category via the api with:


Thanks @blake. You lead me to try Postman, which in turn allowed me to discover my silly mistake: I wasn’t passing the api_key and api_username properly. I guess it worked earlier with creating a topic because this operation doesn’t require authentication.