Creating new topic by API - how do you know which topic ID to use?


#1

The api (Discourse API Docs) states that new topics must specify a topic_id integer, but how do I know the correct integer to use?

For example if I put 1,there already exists a topic with that integer. I could pick a random integer, but that seems a bad approach to take? Am I supposed to loop through all of the topics to find the next topic integer not in use?


(David Taylor) #2

The topic_id is only required if you are adding a post to an existing topic. For a new topic, you do not need to include it in the request.


#3

@david beat me to it

All you need if creating a new topic is the following:
title
raw
category (category number if posting in a particular category)

As well as your api key and username


(David Taylor) #4

This topic was automatically closed after 14 days. New replies are no longer allowed.