Skip to content

Instantly share code, notes, and snippets.

@hoatle
Created June 27, 2011 03:54
Show Gist options
  • Save hoatle/1048288 to your computer and use it in GitHub Desktop.
Save hoatle/1048288 to your computer and use it in GitHub Desktop.
ActivityResources REST spec
h1. activity
{panel}
h2. *POST* +activity._format_+
*Description*
Creates an activity to an identity's activity stream. If no *identityId* is specified, the activity will be created to the authenticated identity's activity stream.
*Url*
{noformat}http://{domain_name}/{rest_context_name}/private/api/social/{version}/{portal_container_name}/activity.format{noformat}
For example:
http://platform35.demo.exoplatform.org/rest/private/api/social/v1/portal/activity.json
http://localhost:8080/rest-socialdemo/private/api/social/v1/socialdemo/activity.json
*Body Data*
An Activity json object of ExoSocialActivityImpl:
For example:
{code:title=Required Params}
{
"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*
## *identityId* Specifies the identity to post this activity to his activity stream. *identityId* must be a connection identity or member space of the authenticated identity.
*Examples*
# *JSON*
## *Request*
{code:title=Request}
POST: http://platform35.demo.exoplatform.org/rest/private/api/social/v1/portal/activity.json
BODY: {"title": "Hello World!!!"}
{code}
## *Response* A created json activity object.
{code:title=Response}
{
"id": "1a2b3c4d5e6f7g8h9j",
"title": "Hello World!!!",
"appId": "",
"type": "exosocial:core",
"postedTime": 123456789, //timestamp
"createdAt": "Fri Jun 17 06:42:26 +0000 2011",
"utcOffset": "-18000",
"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}
{panel}
{panel}
h2. *GET* +activity/:id._format_+
*Description*
Gets an activity object from a specified activity id.
*Url*
{noformat}http://{domain_name}/{rest_context_name}/private/api/social/{version}/{portal_container_name}/activity/:id.format{noformat}
For example:
http://platform35.demo.exoplatform.org/rest/private/api/social/v1/portal/activity/1a2b3c4d5e6f7g8h9i.json
http://localhost:8080/rest-socialdemo/private/api/social/v1/socialdemo/activity/1a2b3c4d5e6f7g8h9i.json
*Supported Format*
json
*Requires Authentication*
true
*Parameters*
* *Required*
## *id*: the id of the existing activity.
* *Optional*
## *poster_identity* When sets this param to *true*, *t* or *1*, the activity returned will provide more information for the user who posted this activity.
## *number_of_comments* Specifies the number of comments to be displayed along with this activity. By default, number_of_comments=0. If number_of_comments is equal to a positive number, this number is considered as a limit number. This limit number 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's recommended to use: "activity/:id/comments.format" instead.
## *activity_stream* When sets this param to *true*, *t* or *1*, the activity returned will provide more information for the activity stream that this activity belongs to.
*Examples*
# *JSON*
## *Request*
{code:title=Request}
GET: http://platform35.demo.exoplatform.org/rest/private/api/social/v1/portal/activity/1a2b3c4d5e6f7g8h9i.json
{code}
## *Response*
{code:title=Response}
{
"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
"numberOfComments": 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}
{panel}
{panel}
h2. *DELETE* +activity/:id._format_+
*Description*
Deletes an existing activity by DELETE method from a specified activity id. Just returns the deleted activity object.
*Url*
{noformat}http://{domain_name}/{rest_context_name}/private/api/social/{version}/{portal_container_name}/activity/:id.format{noformat}
For example:
http://platform35.demo.exoplatform.org/rest/private/api/social/v1/portal/activity/1a2b3c4d5e6f7g8h9i.json
http://localhost:8080/rest-socialdemo/private/api/social/v1/socialdemo/activity/1a2b3c4d5e6f7g8h9i.json
*Supported Format*
json
*Requires Authentication*
true
*Parameters*
* *Required*
## *id*: the id of the existing activity.
*Examples*
# *JSON*
## *Request*
{code:title=Request}
DELETE: http://platform35.demo.exoplatform.org/rest/private/api/social/v1/portal/activity/1a2b3c4d5e6f7g8h9i.json
{code}
## *Response*
{code:title=Response}
{
"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
"numberOfComments": 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}
{panel}
{panel}
h2. *POST* +activity/destroy/:id._format_+
*Description*
Deletes an existing activity by POST method from a specified activity id. Just returns the deleted activity object. Deletes by DELETE method is recommended. This API should be used only when DELETE method is not supported by the client.
*Url*
{noformat}http://{domain_name}/{rest_context_name}/private/api/social/{version}/{portal_container_name}/activity/destroy/:id.format{noformat}
For example:
http://platform35.demo.exoplatform.org/rest/private/api/social/v1/portal/activity/destroy/1a2b3c4d5e6f7g8h9i.json
http://localhost:8080/rest-socialdemo/private/api/social/v1/socialdemo/activity/destroy/1a2b3c4d5e6f7g8h9i.json
*Supported Format*
json
*Requires Authentication*
true
*Parameters*
* *Required*
## *id*: the id of the existing activity.
*Examples*
# *JSON*
## *Request*
{code:title=Request}
POST: http://platform35.demo.exoplatform.org/rest/private/api/social/v1/portal/activity/destroy/1a2b3c4d5e6f7g8h9i.json
{code}
## *Response*
{code:title=Response}
{
"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
"numberOfComments": 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}
{panel}
h1. activity/:id/comments
{panel}
h2. *GET* +activity/:id/comments._format_+
*Description*
Gets the comments on an existing activity.
*Url*
{noformat}http://{domain_name}/{rest_context_name}/private/api/social/{version}/{portal_container_name}/activity/:id/comments.format{noformat}
For example:
http://platform35.demo.exoplatform.org/rest/private/api/social/v1/portal/activity/1a2b3c4d5e/comments.json
http://localhost:8080/rest-socialdemo/private/api/social/v1/socialdemo/activity/1a2b3c4e5e/comments.json
*Supported Format*
json
*Requires Authentication*
true
*Parameters*
* *Optional*
## *count* Specifies the number of comments to retrieve. Must be less than or equal to *100*. The value passed as *count* is a maximum number of comments to be returned. The actual number of comments received maybe less than *count*. If no specified, 100 will be the default value.
## *since_timestamp* Specifies the comments having the created timestamp greater than the specified *since_timestamp*.
## *max_timestamp* Specifies the comments having the created timestamp less than the specified *max_timestamp*.
## *since_id* Specifies the comments having the created timestamps greater than the specified *since_id*'s created timestamp.
## *max_id* Specifies the comments having the created timestamps less than the specified *max_id*'s created timestamp.
*Examples*
# *JSON*
## *Request*
{code:title=Request}
GET: http://platform35.demo.exoplatform.org/rest/private/api/social/v1/portal/activity/1a2b3c4d5e/comments.json
{code}
## *Response* A list of json comment objects.
{code:title=Response}
{
total: 10,
comments: [
{
"identityId": "12345abcde",
"text": "Comment there!",
"postedTime": 123456789,
"createdAt": "Fri Jun 17 06:42:26 +0000 2011"
},
{
"identityId": "12345abcde",
"text": "Comment there 2!",
"postedTime": 123456789,
"createdAt": "Fri Jun 17 06:42:26 +0000 2011"
}
]
}
{code}
{panel}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment