Community articleCreating a community forum topic programmatically
Added by IBM contributorIBM on March 14, 2014
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

To add a topic to a community forum, send an Atom entry document containing the forum topic to the community forum topics resource.
Tags: commapi



To add a topic to a community forum, send an Atom entry document containing the forum topic to the community forum topics resource.

See Authenticating requests for information about how to authenticate the request.

Input

Provide a forum topic Atom entry document.

Note: The content type of the Atom entry document must be application/atom+xml.

If you want to add some tags to this topic. For each tag, add the <category term="tag name"/> element to the topic entry document that you pass in on the request.

If you want to create a question instead of a normal topic, add the <category term="question" scheme="http://www.ibm.com/xmlns/prod/sn/flags"/> element to the topic entry document that you pass in on the request.

To create a topic with an attachment, use a multipart post in the request. See Creating a stand-alone forum topic programmatically for more details.

Output

An Atom entry document containing the new forum topic.

Input
Method URI Description
POST /communities/service/atom/community/forum/topics Value of the href attribute of the <link> element with the rel="http://www.ibm.com/xmlns/prod/sn/forum-topics" attribute value for each community.
Content Type: application/atom+xml
Sample Request:
<?xml version="1.0" encoding="UTF-8"?>

<entry 

 xmlns="http://www.w3.org/2005/Atom" 

 xmlns:app="http://www.w3.org/2007/app" 

 xmlns:snx="http://www.ibm.com/xmlns/prod/sn">

<category scheme="http://www.ibm.com/xmlns/prod/sn/type" term="forum-topic"/>

<title type="text">TEXT OF TOPIC</title>

</entry>
Name Type Optional Description
communityUuid
string No The UUID of the community you wish to create a forum topic in.
Output
Content Type: application/atom+xml
Name Type Optional Description
Location
string No Link to edit_url of the forum topic. You can use the web address specified here to subsequently retrieve and update the forum topic.
Code Description
400
Bad Request.
401
Unauthorized. Returned when no authenticated user or no userid, email, or key parameter are provided on the request.
404
No forum exists: This error is generated when the community does not contain a forum. When you create a community, a forum is created for it by default, but the administrator can remove or hide the forum. See Administering Forums for more details.