To create a community activity, send a POST request to the remote applications feed of the community to which you want to add the activity.
Before you begin
You cannot add activities to a community programmatically until the Activities widget has been added to the community using the Customize menu option in the product user interface. It is not until the widget is explicitly added that the service document resource for activities is available from the remote applications feed.
See Authenticating requests
for information about how to authenticate the request.
Table 1. Atom API request details
Communities remote applications feed
From the entry in the Communities remote application feed that contains the <category term="Activities" scheme="http://www.ibm.com/xmlns/prod/sn/type" /> element, find the value of the href attribute in the <link> element that has the rel="http://www.ibm.com/xmlns/prod/sn/remote-application/feed" attribute.
Atom document that contains a category element (see options above)
Determine the URI to which to POST the activity Atom document to create the community activity by first accessing the service document for remote applications. See Retrieving a remote applications list for more details.
Create an Atom document to represent the community activity. You can specify the community in the following ways:
label="Explicit Membership Community Activity"/>
To create a community activity that inherits its membership from the community to which it belongs and cannot be changed, specify the following category type:
To create a community activity for which you can later define the membership by adding a subset of community members to it, specify the following category type:
Send the Atom document using a POST request to the following URI:
Provide an Atom document that contains a category element that represents the community activity.
The content type of the Atom entry document must be application/atom+xml
Returned HTTP headers
HTTP/1.1 201 Created
Indicates that the community activity was successfully created. If an error occurs, this header will contain one of the error codes below.
Link to edit_url of the new community activity. You can use the web address specified here to subsequently update the community activity.
HTTP/1.1 400 Bad Request
HTTP/1.1 403 Forbidden: Authorization failed.
After creating a community activity with a category of type of explicit_membership_community_activity, you can define the members of the community activity. See Creating a member for more details.
Parent topic: Working with remote applications
Working with activities programmatically
Retrieving a remote applications list
Adding an activity member programmatically