but that post told me that I also need to include the api_key and api_name in the URL!
POST /posts.json?api_key=..very.long.api.key&api_username=thatsme HTTP/1.0
Accept: */*
Accept-Charset: utf-8
Host: www.rebolchat.me
User-Agent: REBOL
Content-Type: application/json
Content-Length: 234
{"title":"Bot Test","topic_id":36,"raw":"this is an api test that I am trying to see if I can make a post and it needs to be 20 characters","category":8,"name":"Graham","color":"49d9e9","text_color":"f0fcfd","created_at":"2017-05-19"}
Sorry for any confusion in the docs. Yes it is showing the example body as JSON mostly just for readability but yes you can create the request as form-data
They are ambiguous, are the same endpoint and will accept the exact same POST body. If the default happens to return JSON then I usually just leave off the .json. Some endpoints that don’t have the extension will return html instead.
That would work, but it actually said:
so you can put the api_key and api_username in the POST body not in the header.
Here is an example curl command for creating a post on a topic:
Bad csrf token when making api request
api_key and api_username are POST parameters, not headers.
so you can put the api_key and api_username in the POST body not in the header.
I must have linked to the wrong post. The one I read said that credentials could not be gleaned from the JSON payload, and you had to also include the api_key and api_username in the query string when using the .json endpoint. And it was only then that I managed to get a HTTP POST working for my bot.
Since it’s working that way I’m going to leave it like that for the moment though I should probably switch to using HTTPS.
I dunno if anyone else is interested but I was posting all of the commit logs of our builds from github, and then linking to the deployed binaries on S3 from travis-ci to a single topic so that we can easily track them together.