Feedback API

The Voting and Rating API provides an Agility developer the ability to easily integrate Voting, Rating, Likes, Approval and Disapproval features against any piece of content within Agility’s content System. There are simple calls that are used to support adding and aggregating these values together.

Agility.UGG.API.SaveRating(ratingFeedback, callback)
The SaveRating method will save a rating to the UGC system. This method expects a RatingFeedback object.
//ID of the content to related the rating to
var NewsID = 12345;

var RatingFeedback = new Agility.UGC.API.RatingFeedback();
RatingFeedback.ReferenceName = "NewsList";
RatingFeedback.ContentType = Agility.UGC.API.FeedbackContentType.WCM;
RatingFeedback.RelatedContentID = NewsID;
RatingFeedback.RatingValue = 3;

Agility.UGC.API.SaveRating(RatingFeedback, function (data) {
    alert("Rating Complete");
});
                        
Agility.UGC.API.SaveLike(booleanFeedback, callback)
The SaveLike method call is used to save Like's on a related content item. This method expects a BooleanFeedback object.
var LikeFeedback = new Agility.UGC.API.BooleanFeedback();
LikeFeedback.ReferenceName = "RecordTypeName";
LikeFeedback.ContentType = Agility.UGC.API.FeedbackContentType.UGC;
LikeFeedback.RelatedContentID = 2825;

Agility.UGC.API.SaveLike(LikeFeedback, function (data) {
    if (data.ResponseType == Agility.UGC.API.ResponseType.OK) {
          alert("Like Successfully Saved");               
    }
 });
                        
Agility.UGC.API.SaveVote(BooleanFeedback, Callback)
The SaveVote method call is used to save Vote's on a related content item. This method expects a BooleanFeedback object.
var VoteFeedback = new Agility.UGC.API.BooleanFeedback();
VoteFeedback .ReferenceName = "RecordTypeName";
VoteFeedback .ContentType = Agility.UGC.API.FeedbackContentType.UGC;
VoteFeedback .RelatedContentID = 2825;

Agility.UGC.API.SaveVote(VoteFeedback, function (data) {
    if (data.ResponseType == Agility.UGC.API.ResponseType.OK) {
          alert("Vote Successfully Saved");               
    }
 });
                        
Agility.UGC.API.SaveApproveDisapprove(booleanFeedback, IsApproved, callback){
The SaveApproveDisapprove method call is used to save "Approval" or "Disapproval" on a related content item. This method expects a BooleanFeedback object and if the value is positive or negative (IsApproved).
var ApprovalFeedback = new Agility.UGC.API.BooleanFeedback();
ApprovalFeedback .ReferenceName = "RecordTypeName";
ApprovalFeedback .ContentType = Agility.UGC.API.FeedbackContentType.UGC;
ApprovalFeedback .RelatedContentID = 2825;

//Save a Positive Feedback entry
Agility.UGC.API.SaveApproveDisapprove(ApprovalFeedback, true, function (data) {
    if (data.ResponseType == Agility.UGC.API.ResponseType.OK) {
          alert("Possitive Approval Successfully Saved");               
    }
 });

//Save a Negative Feedback entry
Agility.UGC.API.SaveApproveDisapprove(ApprovalFeedback, false, function (data) {
 if (data.ResponseType == Agility.UGC.API.ResponseType.OK) {
          alert("Negative Approval Successfully Saved");               
    }
 });
                        
Agility.UGC.API.GetFeedbackAggregate(SearchArgs, Callback)
The GetFeedbackAggregate method is used to perform searches on the Feedback data added by the Save methods above. The SearchArg object is a FeedbackSearchArg object which allows filtering the search results or rolling up based on the parameters passed.
var search = new Agility.UGC.API.FeedbackSearchArg();
search.ReferenceName = "ContentReferenceName";
search.ContentType = Agility.UGC.API.FeedbackContentType.WCM;
search.SubmissionType = Agility.UGC.API.FeedbackSubmissionType.Like;
//array of ID's to look up
search.RelatedContentIDs[0] = 1234;
search.Action = Agility.UGC.API.AggregateTypes.Count;

Agility.UGC.API.GetFeedbackAggregate(search, function (data) {
      alert("Total Likes: " + data.ResponseData[0].Result);
});
                        

Save Rating

var RatingFeedback = new Agility.UGC.API.RatingFeedback();
RatingFeedback.ReferenceName = "CustomTestRatingType";
RatingFeedback.ContentType = Agility.UGC.API.FeedbackContentType.WCM;
RatingFeedback.RelatedContentID = 123;

 RatingFeedback.RatingValue = 3;
 Agility.UGC.API.SaveRating(RatingFeedback, function (data) {
                alert("Rating complete: " + data.ResponseData);
});
                    

Save Like

var LikeFeedback = new Agility.UGC.API.BooleanFeedback();
LikeFeedback.ReferenceName = "MiskiwDataTypes";
LikeFeedback.ContentType = Agility.UGC.API.FeedbackContentType.UGC;
LikeFeedback.RelatedContentID = 2825;

//This line is only for demonstration purposes SaveLike() automatically sets this property
LikeFeedback.SubmissionType = Agility.UGC.API.FeedbackSubmissionType.Like;

 Agility.UGC.API.SaveLike(LikeFeedback, function (data) {
                    if (data.ResponseType == 0) {
                        alert("Like Has been saved: " +data.ResponseData);
                    }
});
                    

Save Vote

var VoteFeedback = new Agility.UGC.API.BooleanFeedback();
VoteFeedback .ReferenceName = "MiskiwDataTypes";
VoteFeedback .ContentType = Agility.UGC.API.FeedbackContentType.UGC;
VoteFeedback .RelatedContentID = 2825;
VoteFeedback .SubmissionType = Agility.UGC.API.FeedbackSubmissionType.Vote;

Agility.UGC.API.SaveVote(LikeFeedback, function (data) {
                    alert("Vote Saved: " +data.ResponseData);
 });
                    

Save Approval/Disapproval

var ApprovalFeedback = new Agility.UGC.API.BooleanFeedback();
ApprovalFeedback .ReferenceName = "MiskiwDataTypes";
ApprovalFeedback .ContentType = Agility.UGC.API.FeedbackContentType.UGC;
ApprovalFeedback .RelatedContentID = 2825;

ApprovalFeedback .SubmissionType = Agility.UGC.API.FeedbackSubmissionType.ApproveDisapprove;

//Approve
Agility.UGC.API.SaveApproveDisapprove(LikeFeedback, true, function (data) {
                    alert(data.ResponseData);
                    LoadStats();
 });

//Disapprove
Agility.UGC.API.SaveApproveDisapprove(LikeFeedback, false, function (data) {
                    alert(data.ResponseData);
                    LoadStats();
});
                    

Feedback Aggregate Like Count

var search = new Agility.UGC.API.FeedbackSearchArg();
search.ReferenceName = "MiskiwUGCCommentLink";
search.ContentType = Agility.UGC.API.FeedbackContentType.WCM;
search.SubmissionType = Agility.UGC.API.FeedbackSubmissionType.Like;
search.RelatedContentID = [1837];
search.Action = Agility.UGC.API.AggregateTypes.Count;

Agility.UGC.API.GetFeedbackAggregate(search, function (data) {
                alert("Total Like Count: " +data.ResponseData[0]);
});
                    

LOGIN

Log in with your Agility username and password or
register for the site




Log In

REGISTER












Register

FORGOT PASSWORD