Create community activities
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 starting
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.
- 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 Retrieve 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:
- 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:
<category scheme="http://www.ibm.com/xmlns/prod/sn/type" term="community_activity" label="Community Activity"/>
- 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:
<category scheme="http://www.ibm.com/xmlns/prod/sn/type" term="explicit_membership_community_activity" label="Explicit Membership Community Activity"/>
- Send the Atom document using a POST request to the following URI:
Table 1. Atom API request details
Method Resource URI Input representation POST 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/publish" attribute. Atom document that contains a category element (see options above)
Input
Provide an Atom document that contains a category element that represents the community activity.Note: The content type of the Atom entry document must be application/atom+xml.
Output
None.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.
Location: url
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 Create a member for more details.
Parent topic
Work with remote applicationsRelated concepts
Work with activities programmaticallyRelated reference
Activity content
Retrieve a remote applications list
Add an activity member programmatically
});