Rating a resource
To rate a resource based on our judgment, you can use the registry instance. Rating a resource can be done using the following line of code:
registry.rateResource("c1/c2/r2 " , 4);
Retrieving the average rating of a resource
An average of all ratings of a particular resource can be retrieved. This can be done using the following line of code:
registry.getAverageRating("c1/c2/r2");
Retrieving the rating given to the resource by a particular user
When a rating given by a particular user for a resource is needed, it can be done using the following line of code:
registry.getRating("c1/c2/r2", "wso2_admin"); // rating given for r2 by wso2 admin