Difference between revisions of "CRM-2 Social API"

From Opentaps Wiki
Jump to navigationJump to search
(Like)
 
(8 intermediate revisions by the same user not shown)
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 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: <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 18: Line 59:
  
 
Parameters:
 
Parameters:
* parentNoteId : id of the activity for which to record a view
+
* parentNoteId : id of the activity for which to record a like
 
* userId : id of the user that viewed the activity
 
* userId : id of the user that viewed the activity
  
=== Thumb Up and Thumb Down ===
+
=== Comments ===
  
Records and retrieves votes either for or against.
+
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.
  
=== Comments ===
+
==== 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>/social/comments/:parentNoteId</tt>
 +
 
 +
Parameters:
 +
* parentNoteId : id of the activity for which to get the 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.
+
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.

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.