Creating an activity from a template
Added by IBM contributorIBM | Edited by Claudia R Elbourn on July 7, 2015
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

To create an activity, send an Atom entry document to the user's My Activities feed.

Discoverability

You can derive the URL from the user's service document. Find the value of the href attribute of element that contains a title element which has a value of Overview.

Steps

1. Retrieve the Atom entry document representing the template from which you want to create the activity. See Retrieving entry templates.
2. Open the Atom entry document, and then remove the following element:

<category scheme="
http://www.ibm.com/xmlns/prod/sn/flags "term="template" label="Template"/>

			
3. You can edit the title of the template to reflect the name of the activity that you want to create.
4. You can edit related element values to reflect the properties of the activity that you want to create.
5. The id of the entry reflect to the activituUuid of the template
6. Send the updated Atom entry document with the POST request to create the activity.
 

Usage notes

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

Request Parameters

None supported.

To retrieve the service document for the Activity Template, send the following request:

GET http://<hostname>/activities/service/atom2/forms/activitynode?activityNodeUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6 HTTP/1.1

Accept: */*

 

Input
Method URI Description
POST /activities/service/atom2/activities You can derive the URL from the user's service document. Find the value of the href attribute of <collection> element that contains a <title> element which has a value of Overview.
Content Type: application/atom+xml
Output
Name Type Optional Description
Location
string No Link to edit_url of the new activity. You can use the web address specified here to subsequently update the activity.
Code Description
201
Indicates that the activity was successfully created. If an error occurs, this header contains one of the error codes.
400
Bad Request. Request was not recognized.
403
Forbidden. Authorization failed.
Examples
GET http://<hostname>/activities/service/atom2/forms/activitynode?activityNodeUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6 HTTP/1.1

	Accept: */*

Response returned by the server
The HTTP response would look as follows:

 

	HTTP/1.1 200 OK

	Accept: application/atom+xml

	xxxxxx: xxxxxx

	<?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"

	  xmlns:xhtml="http://www.w3.org/1999/xhtml"

	  xmlns:thr="http://purl.org/syndication/thread/1.0"

	  snx:checkcache='1372320540475'>

	  <id>urn:lsid:ibm.com:oa:73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6</id>

	  <title type="text">test-ac1-template</title>

	  <updated>2013-06-20T08:52:13Z</updated>

	  <published>2013-06-20T08:52:12Z</published>

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

	  <author>

	  <name>wasadmin</name>

	  <snx:userid>bbecfb53-c268-46de-979c-00067c6ade65</snx:userid>

	  <snx:ldapid>87e76cd5-0f5f-422f-b68d-b28c96a9cda7</snx:ldapid>

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

	  </author>

	  <contributor>

	  <name>wasadmin</name>

	  <snx:userid>bbecfb53-c268-46de-979c-00067c6ade65</snx:userid>

	  <snx:ldapid>87e76cd5-0f5f-422f-b68d-b28c96a9cda7</snx:ldapid>

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

	  </contributor>

	  <category scheme="http://www.ibm.com/xmlns/prod/sn/priority" term="1" label="Normal"/>

	  <category scheme="http://www.ibm.com/xmlns/prod/sn/flags" term="template" label="Template"/>

	  <category term="test-tag1" />

	  <link rel="http://www.ibm.com/xmlns/prod/sn/member-list" type="application/atom+xml" href="http://<hostname>/activities/service/atom2/forms/acl?activityUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6" />

	  <link rel="http://www.ibm.com/xmlns/prod/sn/history" type="application/atom+xml" href="http://<hostname>/activities/service/atom2/forms/activity/history?activityUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6" />

	  <link rel="http://www.ibm.com/xmlns/prod/sn/templates" type="application/atom+xml" href="http://<hostname>/activities/service/atom2/forms/entrytemplates?activityUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6" />

	  <app:collection href="http://<hostname>/activities/service/atom2/forms/activity?activityUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6">

	      <title type="text">test-ac1-template</title>

	      <app:categories href="http://<hostname>/activities/service/atom2/forms/categories?activityUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6"/>

	  </app:collection>

	  <snx:activity>73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6</snx:activity>

	  <link rel="edit" type="application/atom+xml" href="http://<hostname>/activities/service/atom2/forms/activitynode?activityNodeUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6" />

	  <link rel="self" type="application/atom+xml" href="http://<hostname>/activities/service/atom2/forms/activity?activityUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6"/>

	  <link rel="alternate" type="application/xhtml+xml" href="http://<hostname>/activities/service/html/activity/recent?activityUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6"/>

	  <link rel="alternate" type="text/html" href="http://<hostname>/activities/service/html/activity/recent?activityUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6"/>

	  <snx:position>-2147483648</snx:position>

	  <snx:depth>0</snx:depth> 

	  <snx:permissions>none, create_activity, view_activity, edit_activity, delete_activity, activity_owner, edit_activity_tags, design_activity, edit_statements, delete_statements, add_members, delete_members, create_entries, edit_personal_entries, edit_all_entries, delete_personal_entries, delete_all_entries, edit_personal_entry_tags, edit_all_entry_tags, view_members</snx:permissions>

	  <snx:icon>http://<hostname>/activities/nav/common/styles/images/iconTemplate.gif</snx:icon>

	  <content type="text">

	       test-activity goal

	  </content>

	</entry>

	 

 

To send the request document with atom entry to create an Activity from a template:

 

	POST http://<hostname>/activities/service/atom2/forms/activities HTTP/1.1

	Accept: */*

	Content-Type: application/atom+xml;charset="UTF-8"

	xxxxxx: xxxxx

	<?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"

	  xmlns:xhtml="http://www.w3.org/1999/xhtml"

	  xmlns:thr="http://purl.org/syndication/thread/1.0"

	  snx:checkcache='1372320540475'>

	  <id>urn:lsid:ibm.com:oa:73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6</id>

	  <title type="text">test-ac5-from-template</title>

	  <updated>2013-06-20T08:52:13Z</updated>

	  <published>2013-06-20T08:52:12Z</published>

	 

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

	 

	  <author>

	  <name>wasadmin</name>

	  <snx:userid>bbecfb53-c268-46de-979c-00067c6ade65</snx:userid>

	  <snx:ldapid>87e76cd5-0f5f-422f-b68d-b28c96a9cda7</snx:ldapid>

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

	  </author>

	 

	  <contributor>

	  <name>wasadmin</name>

	  <snx:userid>bbecfb53-c268-46de-979c-00067c6ade65</snx:userid>

	  <snx:ldapid>87e76cd5-0f5f-422f-b68d-b28c96a9cda7</snx:ldapid>

	  <snx:role>owner</snx:role>

	  </contributor>

	  <category scheme="http://www.ibm.com/xmlns/prod/sn/priority" term="1" label="Normal"/>

	  <category term="test-tag1" />

	  <link rel="http://www.ibm.com/xmlns/prod/sn/member-list" type="application/atom+xml" href="http://<hostname>/activities/service/atom2/forms/acl?activityUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6" />

	  <link rel="http://www.ibm.com/xmlns/prod/sn/history" type="application/atom+xml" href="http://<hostname>/activities/service/atom2/forms/activity/history?activityUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6" />

	  <link rel="http://www.ibm.com/xmlns/prod/sn/templates" type="application/atom+xml" href="http://<hostname>/activities/service/atom2/forms/entrytemplates?activityUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6" />

	 

	  <app:collection href="http://<hostname>/activities/service/atom2/forms/activity?activityUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6">

	      <title type="text">test-ac1-template</title>

	      <app:categories href="http://<hostname>/activities/service/atom2/forms/categories?activityUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6"/>

	  </app:collection>

	 

	  <snx:activity>73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6</snx:activity>

	   <link rel="edit" type="application/atom+xml" href="http://<hostname>/activities/service/atom2/forms/activitynode?activityNodeUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6" />

	   <link rel="self" type="application/atom+xml" href="http://<hostname>/activities/service/atom2/forms/activity?activityUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6"/>

	   <link rel="alternate" type="application/xhtml+xml" href="http://<hostname>/activities/service/html/activity/recent?activityUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6"/>

	   <link rel="alternate" type="text/html" href="http://<hostname>/activities/service/html/activity/recent?activityUuid=73f72854-c2fc-4ae3-af5f-0ddc9ac85ce6"/>

	 

	  <snx:position>-2147483648</snx:position>

	  <snx:depth>0</snx:depth> 

	  <snx:permissions>none, create_activity, view_activity, edit_activity, delete_activity, activity_owner, edit_activity_tags, design_activity, edit_statements, delete_statements, add_members, delete_members, create_entries, edit_personal_entries, edit_all_entries, delete_personal_entries, delete_all_entries, edit_personal_entry_tags, edit_all_entry_tags, view_members</snx:permissions>

	  <snx:icon>http://<hostname>/activities/nav/common/styles/images/iconTemplate.gif</snx:icon>

	  <content type="text">

	     test-ac5-from-template

	  </content>

	</entry>