Difference between revisions of "CRM-2 Social API"

From Opentaps Wiki
Jump to navigationJump to search
(Comments)
Line 1: Line 1:
 
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.
 
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.
 +
 +
=== Summary ===
 +
 +
Gets the summary of social activities that were applied to a given activity.
 +
 +
Method: GET, URL extension: <tt>/social/activities/:parentNoteId</tt>
 +
 +
Parameters:
 +
* parentNoteId : id of the activity for which to get the summary
 +
 +
Returns 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
  
 
=== Views ===
 
=== Views ===
Line 37: Line 58:
  
 
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.
 
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: <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:
 
* _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>/comments/:parentNoteId</tt>
 
 
Parameters:
 
* parentNoteId : id of the activity for which to get the comments
 

Revision as of 07:39, 20 March 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.

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

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

Thumb Up and Thumb Down

Records and retrieves votes either for or against.

Method: POST, URL extension: /social/thumb-up Method: POST, URL extension: /social/thumb-down

Parameters:

  • parentNoteId : id of the activity for which to record a thumb-up or thumb-down
  • userId : id of the user that voted on the activity

Note: only one of those action is active for a given user and activity, if the user thumb-up then thumb-down his thumb-up is deleted.

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.