h3. activity {anchor:id=SOCref.DevelopersReferences.RestService_APIs_v1alpha1.ActivityResource.Activity}

h4. POST activity.*format*{anchor:id=SOCref.DevelopersReferences.RestService_APIs_v1alpha1.ActivityResource.Activity.Post}

*Description*: Creates an activity to an identity's activity stream. If no *{noformat}identity_id{noformat}* is specified, the activity will be created to the authenticated identity's activity stream.

*URL*:

{code}http://{domain_name}/{rest_context_name}/private/api/social/{version}/{portal_container_name}/activity.format{code}

For example:

[http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity.json]

[http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity.json]

*Body Data*: The data for an activity

For example:
{code:}
{
"title": "Hello World", //required
"type": "exosocial:core", //optional
"priority": 0.5, //optional
"titleId": "", //optional
"templateParams": {
} //optional hashmap
}
{code}


*Supported Format*: json

*Requires Authentication*: true

*Parameters*:
* *Optional*
** *{noformat}identity_id{noformat}*: The identity who posts activities to his stream, to the stream of his connection or the space stream where he is a manager or a member.
*Examples*
* *JSON*
** *Request*
{code:}
POST: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity.json
BODY: {"title": "Hello World!!!"}
{code}

** *Response*: A list of activity objects in the JSON format.
{code}
{
"id": "1a2b3c4d5e6f7g8h9j",
"title": "Hello World!!!",
"appId": "",
"type": "exosocial:core",
"postedTime": 123456789, //timestamp
"createdAt": "Fri Jun 17 06:42:26 +0000 2011",
"priority": 0.5, //between 0.0 and 1.0, higher value => higher priority.
"templateParams": {},
"titleId": "",
"identityId": "123456789abcdefghi" //the identity id of the user who created this activity
}
{code}

h4. GET activity/:activityId.format {anchor:id=SOCref.DevelopersReferences.RestService_APIs_v1alpha1.ActivityResource.Activity.Get}

*Description*: Gets an activity object from a specified activity Id.

*URL*:

{code}http://{domain_name}/{rest_context_name}/private/api/social/{version}/{portal_container_name}/activity/:id.format{code}

For example:

[http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e6f7g8h9i.json]

[http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity/1a2b3c4d5e6f7g8h9i.json]


*Supported Format*: json

*Requires Authentication*: true

*Parameters*:
* *Required*
** *id*: the Id of the existing activity.
* *Optional*
** *{noformat}poster_identity{noformat}*: When setting this parameter to *true*, *t* or *1*, the returned activity will provide more information for the user who posted this activity.
** *{noformat}number_of_comments{noformat}*: Specifies the number of comments to be displayed along with this activity. By default, _{noformat}number_of_comments=0{noformat}_. If _{noformat}number_of_comments{noformat}_ is a positive number, this number is considered as a limit number that must be equal or less than 100. If the actual number of comments is less than the provided positive number, the number of actual comments must be returned. If the total number of comments is more than 100, it is recommended to use _activity/:id/comments.format_ instead.
** *{noformat}activity_stream{noformat}*: When setting this parameter to *true*, *t* or *1*, the returned activity will provide more information for the activity stream that this activity belongs to.

*Examples*:
* *JSON*
** *Request*
{code:}
GET: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e6f7g8h9i.json
{code}

** *Response*
{code: json}
{
"id": "1a2b3c4d5e6f7g8h9j",
"title": "Hello World!!!",
"appId": "",
"type": "exosocial:core",
"postedTime": 123456789, //timestamp
"createdAt": "Fri Jun 17 06:42:26 +0000 2011", //The Date follows ISO 8601
"priority": 0.5, //between 0.0 and 1.0, higher value => higher priority.
"templateParams": {},
"titleId": "",
"identityId": "123456789abcdefghi", //the identity id of the user who created this activity
"liked": true, //is liked (favorites) by this authenticated identity
"likedByIdentities": ["identityId1", "identityId2"],
"posterIdentity": {}, //optional
"comments": [{}, {}, {}], //optional
"totalNumberOfComments": 1234,
"activityStream": {
"type": "user", // or "space"
"prettyId": "root", // or space_abcde
"faviconURL": "http://demo3.exoplatform.org/favicons/exo-default.jpg",
"title": "Activity Stream of Root Root",
"permaLink": "http://platform35.demo.exoplatform.org/profile/root"
} //optional
}
{code}


h4. DELETE activity/:activityId.format {anchor:id=SOCref.DevelopersReferences.RestService_APIs_v1alpha1.ActivityResource.Activity.Delete}

*Description*: Deletes an existing activity by its Id using the DELETE method. The deleted activity information will be returned in the JSON format.

*URL*:

{code}http://{domain_name}/{rest_context_name}/private/api/social/{version}/{portal_container_name}/activity/:id.format{code}

For example:

[http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e6f7g8h9i.json]

[http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity/1a2b3c4d5e6f7g8h9i.json]


*Supported Format*: json

*Requires Authentication*: true

*Parameters*:
* *Required*
** *id*: The Id of the existing activity.

*Examples*
* *JSON*
** *Request*
{code:}
DELETE: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e6f7g8h9i.json
{code}

** *Response*
{code:json}
{
"id": "1a2b3c4d5e6f7g8h9j",
"title": "Hello World!!!",
"appId": "",
"type": "exosocial:core",
"postedTime": 123456789, //timestamp
"createdAt": "Fri Jun 17 06:42:26 +0000 2011", //The Date follows ISO 8601
"priority": 0.5, //between 0.0 and 1.0, higher value => higher priority.
"templateParams": {},
"titleId": "",
"identityId": "123456789abcdefghi", //the identity id of the user who created this activity
"liked": true, //is liked (favorites) by this authenticated identity
"likedByIdentities": ["identityId1", "identityId2"],
"posterIdentity": {}, //optional
"comments": [{}, {}, {}], //optional
"totalNumberOfComments": 1234,
"activityStream": {
  "type": "user", // or "space"
  "prettyId": "root", // or space_abcde
  "faviconURL": "http://demo3.exoplatform.org/favicons/exo-default.jpg",
  "title": "Activity Stream of Root Root",
  "permaLink": "http://platform35.demo.exoplatform.org/profile/root"
} //optional
}
{code}

h4. POST activity/destroy/:activityId.format  {anchor:id=SOCref.DevelopersReferences.RestService_APIs_v1alpha1.ActivityResource.Activity.PostDelete.}

*Description*: Deletes an existing activity by its Id using the POST method. The deleted activity information will be returned in the JSON format. It is recommended to use the DELETE method, except the case that clients cannot make request via this method.

*URL*:

{code}http://{domain_name}/{rest_context_name}/private/api/social/{version}/{portal_container_name}/activity/destroy/:id.format{code}

For example:
[http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/destroy/1a2b3c4d5e6f7g8h9i.json]

[http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity/destroy/1a2b3c4d5e6f7g8h9i.json]


*Supported Format*: json

*Requires Authentication*: true

*Parameters*:
* *Required*
** *id*: The Id of the existing activity.

*Examples*:
* *JSON*
** *Request*
{code}
POST: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/destroy/1a2b3c4d5e6f7g8h9i.json
{code}

** *Response*
{code:}
{
"id": "1a2b3c4d5e6f7g8h9j",
"title": "Hello World!!!",
"appId": "",
"type": "exosocial:core",
"postedTime": 123456789, //timestamp
"createdAt": "Fri Jun 17 06:42:26 +0000 2011", //The Date follows ISO 8601
"priority": 0.5, //between 0.0 and 1.0, higher value => higher priority.
"templateParams": {},
"titleId": "",
"identityId": "123456789abcdefghi", //the identity id of the user who created this activity
"liked": true, //is liked (favorites) by this authenticated identity
"likedByIdentities": ["identityId1", "identityId2"],
"posterIdentity": {}, //optional
"comments": [{}, {}, {}], //optional
"totalNumberOfComments": 1234, //if comments is required, the total number of comments
"activityStream": {
  "type": "user", // or "space"
  "prettyId": "root", // or space_abcde
  "faviconURL": "http://demo3.exoplatform.org/favicons/exo-default.jpg",
  "title": "Activity Stream of Root Root",
  "permaLink": "http://platform35.demo.exoplatform.org/profile/root"
} //optional
}
{code}


h3. activity/:activityId/comments {anchor:id=SOCref.DevelopersReferences.RestService_APIs_v1alpha1.ActivityResource.Activitycomments}


h4. GET activity/activity:id/comments.format  {anchor:id=SOCref.DevelopersReferences.RestService_APIs_v1alpha1.ActivityResource.Activitycomments.Get}

*Description*: Gets the comments on an activity.

*URL*:
{code}http://{domain_name}/{rest_context_name}/private/api/social/{version}/{portal_container_name}/activity/:id/comments.format{code}

For example:
[http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/comments.json]

[http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity/1a2b3c4e5e/comments.json]


*Supported Format*: json

*Requires Authentication*: true

*Parameters*: No

*Examples*:
* *JSON*
** *Request*
{code}
GET: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/comments.json
{code}

** *Response*: A list of comment objects in the JSON format.
{code:title=Response}
{
  total: 10,
  comments: [
  {
    "id": "123456"
    "identityId": "12345abcde",
    "text": "Comment there!",
    "postedTime": 123456789,
    "createdAt": "Fri Jun 17 06:42:26 +0000 2011"
  },
  {
    "id" : "234567"
    "identityId": "12345abcde",
    "text": "Comment there 2!",
    "postedTime": 123456789,
    "createdAt": "Fri Jun 17 06:42:26 +0000 2011"
  }
  ]
}
{code}

h3. activity/:activityId/comment {anchor:id=SOCref.DevelopersReferences.RestService_APIs_v1alpha1.ActivityResource.Activitycomment}

h4. POST activity/:activityId/comment.format   {anchor:id=SOCref.DevelopersReferences.RestService_APIs_v1alpha1.ActivityResource.Activitycomments.Post}

*Description*: Posts a new comment on an existing activity. The poster of this comment is an authenticated identity.

*URL*:

{code}http://{domain_name}/{rest_context_name}/private/api/social/{version}/{portal_container_name}/activity/:activityId/comment.format{code}

For example:

[http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/comment.json]

[http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity/1a2b3c4e5e/comment.json]

*Body data*:
{code}
{
  "text": "My comment here!!!"
}
{code}

*Supported Format*:json

*Requires Authentication*: true

*Parameters*: No

*Examples*:
* *JSON*
** *Request*
{code}
POST: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/comment.json
BODY: {"text": "My comment here!!!"}
{code}


** *Response*: The created comment.
{code}
{
"id": "123456"
"identityId": "12345abcde",
"text": "My comment here!!!",
"postedTime": 123456789,
"createdAt": "Fri Jun 17 06:42:26 +0000 2011"
}
{code}

h4. DELETE activity/:activityId/comment/:commentId.format {anchor:id=SOCref.DevelopersReferences.RestService_APIs_v1alpha1.ActivityResource.Activitycomments.Delete}

*Description*: Deletes an existing comment by its Id.

*URL*:

{code}http://{domain_name}/{rest_context_name}/private/api/social/{version}/{portal_container_name}/activity/:activityId/comment/:commentId.format{code}

For example:

[http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/comment/123456.json]

[http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity/1a2b3c4e5e/comment/123456.json]

*Supported Format*: json

*Requires Authentication*: true

*Parameters*: No

*Examples*:
* *JSON*
** *Request*
{code}
DELETE: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/comment/123456.json
{code}

** *Response*: The deleted comment.
{code:json}
{
"id": "123456"
"identityId": "12345abcde",
"text": "My comment here!!!",
"postedTime": 123456789,
"createdAt": "Fri Jun 17 06:42:26 +0000 2011"
}
{code}

h4. POST activity/:activityId/comment/destroy/:commentId.format {anchor:id=SOCref.DevelopersReferences.RestService_APIs_v1alpha1.ActivityResource.Activitycomments.PostDelete}

*Description*: Deletes an existing comment by its Id using the POST method. The deleted activity information will be returned in the JSON format. It is recommended to use the POST method, except the case that clients cannot make request via this method.

*URL*:

{code}http://{domain_name}/{rest_context_name}/private/api/social/{version}/{portal_container_name}/activity/:activityId/comment/destroy/:commentId.format{code}

For example:

[http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/comment/destroy/123456.json]

[http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity/1a2b3c4e5e/comment/destroy/123456.json]

*Supported Format*: json

*Requires Authentication*: true

*Parameters*: No

*Examples*:
* *JSON*
** *Request*
{code}
POST: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/comment/destroy/123456.json
{code}

** *Response*: The deleted comment
{code}
{
"id": "123456"
"identityId": "12345abcde",
"text": "My comment here!!!",
"postedTime": 123456789,
"createdAt": "Fri Jun 17 06:42:26 +0000 2011"
}
{code}

h3. activity/:activityId/like    {anchor:id=SOCref.DevelopersReferences.RestService_APIs_v1alpha1.ActivityResource.ActivityLike}

h4. POST activity/:activityId/like.format  {anchor:id=SOCref.DevelopersReferences.RestService_APIs_v1alpha1.ActivityResource.ActivityLike.Post}

*Description*: Allows an authenticated identity to do the "like" action on an existing activity.

*URL*:

{code}http://{domain_name}/{rest_context_name}/private/api/social/{version}/{portal_container_name}/activity/:activityId/like.format{code}

For example:

[http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/like.json]

[http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity/1a2b3c4e5e/like.json]

*Supported Format*: json

*Requires Authentication*: true

*Parameters*: No

*Examples*:
* *JSON*
** *Request*
{code:}
POST: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/like.json
{code}

** *Response*
{code:}
{
  "liked": "true"
}
{code}

h4. DELETE activity/:activityId/like.format {anchor:id=SOCref.DevelopersReferences.RestService_APIs_v1alpha1.ActivityResource.ActivityLike.Delete}

*Description*: Allows an identity to remove his "like" action on an activity.

*URL*:

{code}http://{domain_name}/{rest_context_name}/private/api/social/{version}/{portal_container_name}/activity/:activityId/like.format{code}

For example:

[http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/like.json]

[http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity/1a2b3c4e5e/like.json]

*Supported Format*: json

*Requires Authentication*: true

*Parameters*: No

*Examples*:
* *JSON*
** *Request*
{code}
DELETE: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/like.json
{code}

** *Response*
{code}
{
  "liked": false
}
{code}

h4. POST activity/:activityId/like/destroy.format  {anchor:id=SOCref.DevelopersReferences.RestService_APIs_v1alpha1.ActivityResource.ActivityLike.Postdestroy}

*Description*: Allows an identity to remove his "like" action on an activity. It is recommended to use the DELETE method, except the case that clients cannot make request via this method.

*URL*:

{code}http://{domain_name}/{rest_context_name}/private/api/social/{version}/{portal_container_name}/activity/:activityId/like/destroy.format{code}

For example:

[http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/like/destroy.json]

[http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity/1a2b3c4e5e/like/destroy.json]

*Supported Format*: json

*Requires Authentication*: true

*Parameters*: No

*Examples*:
* *JSON*
** *Request*
{code}
POST: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/like/destroy.json
{code}

** *Response*
{code}
{
  "liked": false
}
{code}
