Creating communities
Added by IBM contributorIBM | Edited by Claudia R Elbourn on July 21, 2015
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

You can call the Communities API with the POST method to create a new community.
Tags: commapi
 
Input
Method URI Description
POST /communities/service/atom/communities/my Value of the href attribute of <collection> element in the Communities Collections workspace with a child <title> that has the value My Communities.
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">

<title type="text">Day Care Community</title>

<content type="html">Share information about day care.</content>

<author>

<name>John Jordan</name>

<email>jjordan@example.com</email>

<snx:userid>50730340-0101-102e-88e1-f78755f7e0ed</snx:userid>

<snx:userState>active</snx:userState>

</author>

<contributor>

<name>John Jordan</name>

<email>jjordan@example.com</email>

<snx:userid>50730340-0101-102e-88e1-f78755f7e0ed</snx:userid>

<snx:userState>active</snx:userState>

</contributor>

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

<snx:communityType>public</snx:communityType>

</entry>
Output
Name Type Optional Description
Location
string No Link to edit_url of the new community entry. You can use the web address specified here to subsequently retrieve and update the community entry.
Code Description
201
Created. Indicates that the community was successfully created. If an error occurs, this header contains one of the error codes.
400
Bad Request.
401
Unauthorized. Returned when no authenticated user or no userid, email, or key parameter are provided on the request.
409
Conflict: Another publicly viewable community has the same name.
Examples
> POST /communities/service/atom/communities/my HTTP/1.1

> Authorization: Basic xxx

> Host: enterprise.example.com

> Accept: */*

> Content-Type: application/atom+xml

> Content-Length: 920


Response returned by the server
<?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">

<id>ignored</id>

<title type="text">Day Care Community</title>

<summary type="text">ignored</summary>

<content type="html">Share information about day care.</content>

<published>ignored</published>

<author>

<name>John Jordan</name>

<email>jjordan@example.com</email>

<snx:userid>50730340-0101-102e-88e1-f78755f7e0ed</snx:userid>

<snx:userState>active</snx:userState>

</author>

<updated>ignored</updated>

<contributor>

<name>John Jordan</name>

<email>jjordan@example.com</email>

<snx:userid>50730340-0101-102e-88e1-f78755f7e0ed</snx:userid>

<snx:userState>active</snx:userState>

</contributor>

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

<snx:membercount>ignored</snx:membercount>

<snx:communityType>public</snx:communityType>

</entry>