Skip to content

Conversation

alxpck
Copy link

@alxpck alxpck commented Aug 9, 2018

I noticed that the path for "Create a new topic, a new post, or a private message" wasn't working. After debugging by using the UI and looking at the developer console I noticed the path was posts instead of posts.json.

In the swagger.yml file it looks like the path was missing altogether and using the path of the preceding item which happened to be posts.json so it looked very similar.

... this if my first PR so if I'm not following the right etiquette or protocol please let me know. Thanks :) I wasn't actually sure how to do this and got a lot of value out of the step-by-step guide in this post: https://meta.discourse.org/t/discourse-development-contribution-guidelines/3823

@oblakeerickson
Copy link
Contributor

Thanks so much for creating a PR!

Rails actually lets you define what kind of content you want to return based on the extension so for most routes in discourse posts or posts.json is the exact same route it just depends on what the return type is that you want (html or json).

I just verified and I was able to create a topic with this curl request

curl -X POST "https://url/posts.json" \ -H "Content-Type: multipart/form-data;" \ -F "api_key=apikey" \ -F "api_username=username" \ -F "title=mytitlewithoutanyspaces" \ -F "raw=mypostwithoutanyspaces" 

What wasn't working for you when you hit the posts.json endpoint? Can you send me an example api call that you were making?

I do appreciate the PR though and if you find anything else that needs improvement please submit another one.

@alxpck
Copy link
Author

alxpck commented Aug 10, 2018

You're absolutely right. The curl works for me and I just double-checked my python requests code and it works with posts.json.

It must have been something else I was doing, that I resolved at the same time I changed posts/ vs. posts.json.

Appreciate the help.

@alxpck alxpck closed this Aug 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants