Review & Rating System

Manage reviews and ratings for any app items. The item can be anything having a unique ID such as an app on app store/marketplace, items in a catalogue, articles, blogs, etc. It also manages the review comments and their respective ratings. It provides various methods to find average, highest and lowest rated reviews. Reviews can also be muted or unmuted if they have any objectionable content.

Import Statement
  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. using com.shephertz.app42.paas.sdk.csharp;    
  2. using com.shephertz.app42.paas.sdk.csharp.review;    
Initialize

In order to use the various functions available in a specific API, the developer has to initialize with App42API by passing the apiKey and the secretKey which will become available after the app creation from AppHQ dashboard.

Required Parameters

apiKey - The Application key given when the application was created. secretKey - The secret key corresponding to the application key given when the application was created.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. App42API.Initialize("API_KEY","SECRET_KEY");  
Build Service

After initialization, the developer will have to call the buildXXXService method on App42API to get the instance of the particular API that they wish to build. For example, to build an instance of Review Service, buildReviewService() method needs to be called.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. ReviewService reviewService = App42API.BuildReviewService();   
Create Review

Create review for the specified item with comment and rating on that item.

Required Parameters

userID - The user who created the review. itemID - The item for which the review has to be created. reviewComment - Comment on review. reviewRating - Rating of the item.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. String userID = "Nick";  
  2. String itemID = "itemID";  
  3. String reviewComment = "reviewComment";  
  4. double reviewRating = 3;                      
  5. App42API.Initialize("API_KEY","SECRET_KEY");  
  6. ReviewService reviewService = App42API.BuildReviewService();   
  7. Review review = reviewService.CreateReview(userID,itemID,reviewComment,reviewRating);   
  8. Console.WriteLine("userId is " + review.GetUserId());  
  9. Console.WriteLine("itemId is " + review.GetItemId());    
  10. String jsonResponse = review.ToString();      
Get All Reviews

Fetch all reviews in the App.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. App42API.Initialize("API_KEY","SECRET_KEY");  
  2. ReviewService reviewService = App42API.BuildReviewService();   
  3. IList<Review> review = reviewService.GetAllReviews();  
  4. for(int i=0;i<review.Count;i++){  
  5.     Console.WriteLine("userId is " + review[i].GetUserId());  
  6.     Console.WriteLine("itemId is " + review[i].GetItemId());   
  7. }  
Get All Reviews Count

Fetch count of all reviews in the App.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. App42API.Initialize("API_KEY","SECRET_KEY");  
  2. ReviewService reviewService = App42API.BuildReviewService();   
  3. App42Response response = reviewService.GetAllReviewsCount();   
  4. Boolean  success = response.IsResponseSuccess();  
  5. String jsonResponse = response.ToString();   
Get All Reviews Paging

Fetch all reviews in the app by paging.

Required Parameters

max - Maximum number of records to be fetched. offset - From where the records are to be fetched.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. int max = 1;  
  2. int offset = 0 ;  
  3. App42API.Initialize("API_KEY","SECRET_KEY");  
  4. ReviewService reviewService = App42API.BuildReviewService();   
  5. IList<Review> review = reviewService.GetAllReviews(max,offset);   
  6. for(int i=0;i<review.Count;i++){  
  7.     Console.WriteLine("userId is " + review[i].GetUserId());  
  8.     Console.WriteLine("itemId is " + review[i].GetItemId());   
  9. }  
Get Reviews By Item

Fetch all reviews based on the itemId.

Required Parameters

itemId - The item ID for which reviews have to be fetched.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. String itemId = "itemId";  
  2. App42API.Initialize("API_KEY","SECRET_KEY");  
  3. ReviewService reviewService = App42API.BuildReviewService();   
  4. IList<Review> review = reviewService.GetReviewsByItem(itemId);   
  5. for(int i=0;i<review.Count;i++){  
  6.     Console.WriteLine("userId is " + review[i].GetUserId());  
  7.     Console.WriteLine("itemId is " + review[i].GetItemId());   
  8. }  
Get Reviews Count By Item

Fetches the count of All Reviews based on the itemId.

Required Parameters

itemId - The item id for which count of reviews has to be fetched.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. String itemId = "itemId";  
  2. App42API.Initialize("API_KEY","SECRET_KEY");  
  3. ReviewService reviewService = App42API.BuildReviewService();   
  4. App42Response response = reviewService.GetReviewsCountByItem(itemId);   
  5. Boolean  success = response.IsResponseSuccess();  
  6. String jsonResponse = response.ToString();   
Get Reviews By Item Paging

Fetch all reviews based on the itemId by paging.

Required Parameters

itemId - The item for which reviews have to be fetched. max - Maximum number of records to be fetched. offset - From where the records are to be fetched.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. String itemId = "itemId";  
  2. int max = 1;  
  3. int offset= 0;  
  4. App42API.Initialize("API_KEY","SECRET_KEY");  
  5. ReviewService reviewService = App42API.BuildReviewService();   
  6. IList<Review> review = reviewService.GetReviewsByItem(itemId,max,offset);   
  7. for(int i=0;i<review.Count;i++){  
  8.     Console.WriteLine("userId is " + review[i].GetUserId());  
  9.     Console.WriteLine("itemId is " + review[i].GetItemId());   
  10. }  
Get Highest Review By Item

Fetch the highest review for the specified itemId.

Required Parameters

itemId - The item ID for which the highest review has to be fetched.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. String itemId = "itemId";  
  2. App42API.Initialize("API_KEY","SECRET_KEY");  
  3. ReviewService reviewService = App42API.BuildReviewService();   
  4. Review review = reviewService.GetHighestReviewByItem(itemId);   
  5. Console.WriteLine("rating is " + review.GetRating());  
  6. Console.WriteLine("itemId is " + review.GetItemId());    
  7. String jsonResponse = review.ToString();      
Get Lowest Review By Item

Fetch the lowest review for the specified itemId.

Required Parameters

itemId - The item id for which the lowest review has to be fetched.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. String itemId = "itemId";  
  2. App42API.Initialize("API_KEY","SECRET_KEY");  
  3. ReviewService reviewService = App42API.BuildReviewService();   
  4. Review review = reviewService.GetLowestReviewByItem(itemId);   
  5. Console.WriteLine("rating is " + review.GetRating());  
  6. Console.WriteLine("itemId is " + review.GetItemId());    
  7. String jsonResponse = review.ToString();      
Get Average Review By Item

Fetch the average review for the specified itemId.

Required Parameters

itemId - The item for which the average review has to be fetched.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. String itemId = "itemId";  
  2. App42API.Initialize("API_KEY","SECRET_KEY");  
  3. ReviewService reviewService = App42API.BuildReviewService();   
  4. Review review = reviewService.GetAverageReviewByItem(itemId);   
  5. Console.WriteLine("rating is " + review.GetRating());  
  6. Console.WriteLine("itemId is " + review.GetItemId());    
  7. String jsonResponse = review.ToString();      
Get Reviews Count By Item And Rating

Fetch count of all reviews based on the itemId and rating.

Required Parameters

itemId - The item ID for which count of reviews has to be fetched. rating - Rating for which count of reviews has to be fetched.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. String itemId = "itemId";  
  2. double rating = 4;  
  3. App42API.Initialize("API_KEY","SECRET_KEY");  
  4. ReviewService reviewService = App42API.BuildReviewService();   
  5. App42Response response = reviewService.GetReviewsCountByItemAndRating(itemId,rating);   
  6. Boolean  success = response.IsResponseSuccess();  
  7. String jsonResponse = response.ToString();   
Add Comment

Add a review comment for the existing itemId of the user.

Required Parameters

userId - User who want to add the comment. itemId - Item for which the comment has to be added. comment - Comment for the review.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. String userId = "userID";  
  2. String itemId = "itemId";  
  3. String comment = "comment";  
  4. App42API.Initialize("API_KEY","SECRET_KEY");  
  5. ReviewService reviewService = App42API.BuildReviewService();   
  6. Review review = reviewService.AddComment(userId,itemId,comment);   
  7. Console.WriteLine("userId is " + review.GetUserId());  
  8. Console.WriteLine("itemId is " + review.GetItemId());    
  9. String jsonResponse = review.ToString();      
Get Comments By Item

Fetch the review comment for the item.

Required Parameters

itemId - The item for which the comment has to be fetched.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. String itemId = "itemId";  
  2. App42API.Initialize("API_KEY","SECRET_KEY");  
  3. ReviewService reviewService = App42API.BuildReviewService();   
  4. IList<Review> review = reviewService.GetCommentsByItem(itemId);   
  5. for(int i=0;i<review.Count;i++)  
  6. {  
  7.     Console.WriteLine("userId is " + review[i].GetUserId());  
  8.     Console.WriteLine("comment is " + review[i].GetComment());   
  9. }  
Mute

Mute the specified review.

Required Parameters

reviewId - The ID of the review which has to be muted.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. String reviewId = "reviewId";  
  2. App42API.Initialize("API_KEY","SECRET_KEY");  
  3. ReviewService reviewService = App42API.BuildReviewService();   
  4. App42Response response = reviewService.Mute(reviewId);   
  5. Boolean  success = response.IsResponseSuccess();  
  6. String jsonResponse = response.ToString();   
Unmute

Unmute the specified review.

Required Parameters

reviewId - The Id of the review which has to be unmuted.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. String reviewId = "reviewId";  
  2. App42API.Initialize("API_KEY","SECRET_KEY");  
  3. ReviewService reviewService = App42API.BuildReviewService();   
  4. App42Response response = reviewService.Unmute(reviewId);   
  5. Boolean  success = response.IsResponseSuccess();  
  6. String jsonResponse = response.ToString();   
Delete Review By Review ID

Delete the specific review based on review ID.

Required Parameters

reviewId - The ID of the review which has to be deleted.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. String reviewId = "reviewId";  
  2. App42API.Initialize("API_KEY","SECRET_KEY");  
  3. ReviewService reviewService = App42API.BuildReviewService();   
  4. App42Response response = reviewService.DeleteReviewByReviewId(reviewId);   
  5. Boolean  success = response.IsResponseSuccess();  
  6. String jsonResponse = response.ToString();   
Delete Comment By Comment ID

Delete the specific comment by comment ID.

Required Parameters

commentId - The ID of the comment which has to be deleted.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. String commentId = "commentId";  
  2. App42API.Initialize("API_KEY","SECRET_KEY");  
  3. ReviewService reviewService = App42API.BuildReviewService();   
  4. App42Response response = reviewService.DeleteCommentByCommentId(commentId);   
  5. Boolean  success = response.IsResponseSuccess();  
  6. String jsonResponse = response.ToString();   
Get All Reviews By User

Fetch all reviews created by user.

Required Parameters

userID - User who wants to retrieve all his reviews.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
Exception Handling

The functions available under Review and Rating Service API can throw some exceptions in abnormal conditions. For example, a developer is trying to get review item with item id and that item id does not exist, the function will throw the App42Exception (as shown below) with message as “Not Found” and the appErrorCode as “3100” and the details as “Reviews for the Item with Id ‘@itemid’ do not exist”.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
  1. $itemId = "itemId";  
  2. App42API::initialize("API_KEY","SECRET_KEY");  
  3. $reviewService = App42API::buildReviewService();  
  4. try  
  5. {  
  6.     $review = $reviewService->getReviewsByItem($itemId);  
  7. }   
  8. catch(App42Exception $ex)   
  9. {  
  10.     $appErrorCode = $ex->getAppErrorCode();  
  11.     $httpErrorCode = $ex->getHttpErrorCode();  
  12.     if($appErrorCode == 3100)  
  13.     {  
  14.         // Handle here for Not Found (Reviews for the Item with Id '@itemid' do not exist.)  
  15.     }  
  16.     else if($appErrorCode == 1401)  
  17.     {  
  18.         // handle here for Client is not authorized  
  19.     }  
  20.     else if($appErrorCode == 1500)  
  21.     {  
  22.         // handle here for Internal Server Error  
  23.     }  
  24.     $jsonText = $ex->getMessage();   
  25. }                            
Error Codes

Functions in Session API might throw exceptions with following HTTP and Application Error Codes (along with their descriptions):

1400 - BAD REQUEST - The Request parameters are invalid 1401 - UNAUTHORIZED - Client is not authorized 1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again 3100 - NOT FOUND - Reviews for the Item with Id '@itemId' do not exist. 3101 - NOT FOUND - Review with the Id '@reviewId' does not exist. 3102 - BAD REQUEST - Reviews for the User with Id '@userId' and Item with Id '@itemId' already exists. 3103 - NOT FOUND - Reviews do not exist. 3104 - NOT FOUND - The number of reviews are less than the specified offset : + "offset". 3105 - NOT FOUND - The number of reviews for the Item with Id '@itemId' are less than the specified offset : + "offset". 3106 - BAD REQUEST - The request parameters are invalid. Comment with UserId '@userId' and ItemId '@itemId' already exists . 3107 - NOT FOUND - Comments for the Item with Id '@itemId' do not exist. 3108 - NOT FOUND - Comment with the Id '@commentId' does not exist. 3109 - NOT FOUND - Comment with the Id '@commentId' does not exist.