Difference between revisions of "CRM-2 Social API"
(2 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
* parentNoteId : id of the activity for which to get the summary | * parentNoteId : id of the activity for which to get the summary | ||
− | Returns JSON structure with: | + | Returns a JSON structure with: |
* thumbsUp: number of thumbs-up | * thumbsUp: number of thumbs-up | ||
* thumbsDown: number of thumbs-down | * thumbsDown: number of thumbs-down | ||
Line 21: | Line 21: | ||
* hasLike: same with like | * hasLike: same with like | ||
* hasComment: boolean flag indicating if the given user has commented on that activity | * hasComment: boolean flag indicating if the given user has commented on that activity | ||
+ | |||
+ | === Thumbs Up === | ||
+ | |||
+ | Records or retrieves the number of times the activity has been thumbed up. | ||
+ | |||
+ | Method: POST, URL extension: <tt>/social/thumb-up</tt> | ||
+ | |||
+ | Parameters: | ||
+ | * parentNoteId : id of the activity for which to record a thumb up | ||
+ | * userId : id of the user that thumbed the activity | ||
+ | |||
+ | === Thumbs Down === | ||
+ | |||
+ | Records or retrieves the number of times the activity has been thumbed down. | ||
+ | |||
+ | Method: POST, URL extension: <tt>/social/thumb-down</tt> | ||
+ | |||
+ | Parameters: | ||
+ | * parentNoteId : id of the activity for which to record a thumb down | ||
+ | * userId : id of the user that thumbed the activity | ||
=== Views === | === Views === | ||
Line 42: | Line 62: | ||
* userId : id of the user that viewed the activity | * userId : id of the user that viewed the activity | ||
− | === | + | === Comments === |
− | Records and | + | Records comments. A comment is first created in the pending state and will be emailed to the domain administrator (user with DOMAIN_CONF permission), who needs to approve or reject the comment. Only approved comments will be retrieved for display. |
− | Method: POST, URL extension: <tt>/social/ | + | ==== Posting comments ==== |
− | Method: POST, URL extension: <tt>/social/ | + | |
+ | Method: POST, URL extension: <tt>/social/comment</tt> | ||
+ | |||
+ | Parameters: | ||
+ | * parentNoteId : id of the activity for which to record a comment | ||
+ | * userId : id of the user that commented | ||
+ | * noteText : the text of the comment | ||
+ | |||
+ | Comments are pending moderation, the next method is to manage that. | ||
+ | |||
+ | ==== Moderating comments ==== | ||
+ | |||
+ | Method: POST or GET, URL extension: <tt>/social/comment/:_id/:action</tt> | ||
Parameters: | Parameters: | ||
− | * | + | * _id : id of the comment |
− | * | + | * action : either "accept" or "reject" |
+ | |||
+ | With "accept" the comment becomes accepted and visible by all the users, "reject" rejects the comment and it stays invisible. | ||
+ | |||
+ | ==== Retreiving comments ==== | ||
− | + | Method: GET, URL extension: <tt>/social/comments/:parentNoteId</tt> | |
− | + | Parameters: | |
+ | * parentNoteId : id of the activity for which to get the comments | ||
− | + | Returns a JSON array of comment activities. |
Latest revision as of 07:11, 7 April 2015
The social API allows you to record social interactions of your customers, such as views, likes (faves), votes for and against, and comments. They can be related to other activities or to other nodes, such as web pages or blog posts. The API does not include the user interface but is meant to be called from the user interface to record the interactions.
Contents
Summary
Gets the summary of social activities that were applied to a given activity.
Method: GET, URL extension: /social/activities/:parentNoteId
Parameters:
- parentNoteId : id of the activity for which to get the summary
Returns a JSON structure with:
- thumbsUp: number of thumbs-up
- thumbsDown: number of thumbs-down
- views: number of views
- likes: number of likes
- comments: number of comments
- hasThumbUp: boolean flag indicating if the given user has thumb-up that activity
- hasThumbDown: same with thumb-down
- hasView: same with view
- hasLike: same with like
- hasComment: boolean flag indicating if the given user has commented on that activity
Thumbs Up
Records or retrieves the number of times the activity has been thumbed up.
Method: POST, URL extension: /social/thumb-up
Parameters:
- parentNoteId : id of the activity for which to record a thumb up
- userId : id of the user that thumbed the activity
Thumbs Down
Records or retrieves the number of times the activity has been thumbed down.
Method: POST, URL extension: /social/thumb-down
Parameters:
- parentNoteId : id of the activity for which to record a thumb down
- userId : id of the user that thumbed the activity
Views
Records or retrieves the number of times the activity has been viewed.
Method: POST, URL extension: /social/view
Parameters:
- parentNoteId : id of the activity for which to record a view
- userId : id of the user that viewed the activity
Like
Records or retrieves the likes or faves of an activity.
Method: POST, URL extension: /social/like
Parameters:
- parentNoteId : id of the activity for which to record a like
- userId : id of the user that viewed the activity
Comments
Records comments. A comment is first created in the pending state and will be emailed to the domain administrator (user with DOMAIN_CONF permission), who needs to approve or reject the comment. Only approved comments will be retrieved for display.
Posting comments
Method: POST, URL extension: /social/comment
Parameters:
- parentNoteId : id of the activity for which to record a comment
- userId : id of the user that commented
- noteText : the text of the comment
Comments are pending moderation, the next method is to manage that.
Moderating comments
Method: POST or GET, URL extension: /social/comment/:_id/:action
Parameters:
- _id : id of the comment
- action : either "accept" or "reject"
With "accept" the comment becomes accepted and visible by all the users, "reject" rejects the comment and it stays invisible.
Retreiving comments
Method: GET, URL extension: /social/comments/:parentNoteId
Parameters:
- parentNoteId : id of the activity for which to get the comments
Returns a JSON array of comment activities.