Topic-related REST APIs

Topics function as labels. We make them so it is easier for users to identify the overall theme of a grouping of nodes. We designed this section to guide you in creating API requests that involve topics.

Documentation Related to Topics

🚧

NOTE:

  • There is no explicit REST API request to create a topic.
    • Whenever a node is posted with one or more topics:
      • If the topic already exists, then the node links to the listed topic(s).
      • If the topic does not already exist, a new topic is created for each newly submitted topic and then the node links to that topic.

📘

Notes for topicIds:

  • While using the suggested request methods, remember that all topics are also nodes and that, in almost all cases, fields and parameters that work with nodes will also work with topics.

    • Please refer to the node section if you want to review the details relevant to these requests.
  • Remember: All concrete sub-types of node (questions, answers, or comments) share the same pool of assigned identifiers.

    • You can find a topic's topicId by following the steps in the Find a Topic's topicId task.
    • You can also find a Topic ID by making a request to retrieve a list of all the topics.
    • Anywhere you need a topicId for a request, the nodeId will serve the same purpose (they are the same number).

Topic Data Model

Field Summary

Field NameTypeExample(s)Description
topicIdID: Integer (64bits)38This is the integer (digit) formatted identifier for a given topic.
typeconst String(always) "topic"This is the type discriminator field (limiting which types get returned in a request).
creationDateTimestamp1328890206000This is the timestamp formatted creation date of a topic (presented in milliseconds since creation).
creationDateFormattedString02/10/2012 11:10 AMThis is the topic creation time and date in a human readable format.
nameStringNews,"Social"This is the name of a given topic.
createdByUser{id,username}{"id":12,"username":"docs"}This is the user that first created the topic. Note: This parameter only has 2 sub-fields: Id and username.
usedCountInteger55This is a count of the number of nodes tagged with a given topic.