Community articleCreating a Related Community programmatically
Added by IBM contributorIBM on April 3, 2014
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Creating a Related Community programmatically


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



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

Input

Provide a Related Community entry document.

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

Input
Method URI Description
POST /communities/recomm/atom/relatedCommunity add a topic to a stand-alone forum
Content Type: application/atom+xml
Sample Request:
<entry xmlns="http://www.w3.org/2005/Atom">

<title type="text">This is a related community</title>

<content type="text">Add a related community.</content>

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

<link

href="http://lc30linux4.swg.usma.ibm.com/communities/service/html/communityview?communityUuid=dc1a846d-59c3-4c95-9d13-6724582ab170"

rel="http://www.ibm.com/xmlns/prod/sn/related-community" type="text/html"></link>

</entry>
Name Type Optional Description
communityUuid
string No The uuid of the community which you want to add this Related Community to.
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
201
Indicates that the Related Community was successfully created. If an error occurs, this header contains one of the error codes.
400
Bad Request.
401
Unauthorized.
403
Forbidden.
404
No forum exists.
Examples
 POST /communities/recomm/atom/relatedCommunity?communityUuid=bfcec17e-235c-4bd7-9fd5-2ba98779bd70 HTTP/1.1


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

<title type="text">This is a related community</title>

<content type="text">Add a related community.</content>

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

<link

href="http://lc30linux4.swg.usma.ibm.com/communities/service/html/communityview?communityUuid=dc1a846d-59c3-4c95-9d13-6724582ab170"

rel="http://www.ibm.com/xmlns/prod/sn/related-community" type="text/html"></link>

</entry>

Response returned by the server
 HTTP/1.1 403 Forbidden


HTTP/1.1 400 Bad Request or 500 or others

Content-Type: text/xml;charset=UTF-8


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

<code>400</code>

<message>Error message </message>

<trace>Exception trace </trace>

</error>


HTTP/1.1 201 Created


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

<id>urn:lsid:ibm.com:recomm:relatedcommunity:11bd8995-8d8f-4a73-a633-26974984a1e5</id>

<snx:communityUuid xmlns:snx="http://www.ibm.com/xmlns/prod/sn">bfcec17e-235c-4bd7-9fd5-2ba98779bd70</snx:communityUuid>

<snx:relatedCommunityUuid xmlns:snx="http://www.ibm.com/xmlns/prod/sn">dc1a846d-59c3-4c95-9d13-6724582ab170</snx:relatedCommunityUuid>

<snx:permissions xmlns:snx="http://www.ibm.com/xmlns/prod/sn">edit,delete</snx:permissions>

<title type="text">This is a related community</title>

<published>2012-08-16T07:43:52.000Z</published>

<author>

<snx:userid xmlns:snx="http://www.ibm.com/xmlns/prod/sn">50730340-0101-102e-88f0-f78755f7e0ed</snx:userid>

<email>ajones22@janet.iris.com</email>

<name>Amy Jones22</name>

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

</author>

<updated>2012-08-16T07:43:52.000Z</updated>

<contributor>

<snx:userid xmlns:snx="http://www.ibm.com/xmlns/prod/sn">50730340-0101-102e-88f0-f78755f7e0ed</snx:userid>

<email>ajones22@janet.iris.com</email>

<name>Amy Jones22</name>

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

</contributor>

<content type="text">Add a related community.</content>

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

<link href="http://lc30linux4.swg.usma.ibm.com/communities/service/html/communityview?communityUuid=dc1a846d-59c3-4c95-9d13-6724582ab170" rel="http://www.ibm.com/xmlns/prod/sn/related-community" type="text/html">

<link href="http://lc30linux4.swg.usma.ibm.com/communities/service/html/communityview?communityUuid=dc1a846d-59c3-4c95-9d13-6724582ab170" rel="alternate" type="text/html">

<link href="http://lc30linux3.swg.usma.ibm.com/communities/recomm/atom_form/relatedCommunity?entryId=11bd8995-8d8f-4a73-a633-26974984a1e5" rel="self" type="application/atom+xml">

<link href="http://lc30linux3.swg.usma.ibm.com/communities/recomm/atom_form/relatedCommunity?entryId=11bd8995-8d8f-4a73-a633-26974984a1e5" rel="edit" type="application/atom+xml">

</entry>