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

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?

1 Like

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.

4 Likes

@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

4 Likes

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