Api for replying post


(san) #1

How can i reply a using API, I have no problem creating a topic but how can i reply to a existing topic.


(David Liaw) #2

It’s a POST to /posts with the following form data:

raw
topic_id
reply_to_post_number (if replying to a post)
category (category ID)
archetype (not sure if this is required or not, but I leave it in anyway as 'regular').

You can find out most of the API endpoints from watching how the Discourse web app does it (through your browser’s network inspector or something like wireshark), since it also uses the API.


Find the reply key of a topic
(Kane York) #3

Don’t forget to add either:

  • api_username and api_key form data
  • X-CSRF-Token: and Cookie: headers

(san) #4

Thank you it works. I did it with Discourse PHP API