A question came up recently in one of my GitHub repositories where someone was wondering if you could enable ratings on a SharePoint list via the REST API.

After a bit of research, I found an undocumented (use this at your own risk!) API. The Microsoft API has an endpoint listed under the root _api folder named Microsoft.SharePoint.Portal.RatingSettings.SetListRating.
This endpoint requires a POST request and takes two parameters: listID and ratingType (1 = Star Ratings, 2=Likes)
Enable Ratings “Likes”
fetch("https://yourtenant.sharepoint.com/sites/yoursite/_api/Microsoft.SharePoint.Portal.RatingSettings.SetListRating?listID='6b847372-cf23-4bbf-87b1-72ca6c8a4bc1'&ratingType=2", {
"headers": {
"accept": "application/json",
"accept-language": "en-US,en;q=0.9",
"cache-control": "max-age=0",
"content-type": "application/json;odata=verbose;charset=utf-8",
"if-match": "*",
"x-http-method": "MERGE",
"x-requestdigest": "<YourRequestDigest>"
},
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "POST",
"mode": "cors",
"credentials": "include"
});
Enable Ratings “Star Ratings”
fetch("https://yourtenant.sharepoint.com/sites/yoursite/_api/Microsoft.SharePoint.Portal.RatingSettings.SetListRating?listID='6b847372-cf23-4bbf-87b1-72ca6c8a4bc1'&ratingType=1", {
"headers": {
"accept": "application/json",
"accept-language": "en-US,en;q=0.9",
"cache-control": "max-age=0",
"content-type": "application/json;odata=verbose;charset=utf-8",
"if-match": "*",
"x-http-method": "MERGE",
"x-requestdigest": "<YourRequestDigest>"
},
"body": null,
"method": "POST",
"mode": "cors",
"credentials": "include"
});
A quick reminder…
As mentioned previously, this is an undocumented API and I’ll probably get yelled at for promoting it! 🙂 So please, use this at your risk as you won’t be provided any support from Microsoft if you implement this.