I can like a page using:
/_api/web/lists/getByTitle('SitePages')/GetItemById(722)/like
Modern pages also allow users to like a comment but this api call doesn't work:
/_api/web/lists/getByTitle('SitePages')/GetItemById(<pageid>)/Comments(<commentid>)/like
Error:
"error": {
"code": "-2147024891, System.UnauthorizedAccessException",
"message": {
"lang": "en-US",
"value": "Attempted to perform an unauthorized operation."
}
For this function Msft references a really long ID - but surely there's an easier way?
"ID":"1.94fdcc5fc39b4a2c99ae4570caf02321.d0a03fb1761a404a9a8e7f9f5ec58e17.5a1067e8af65410b9e2ba6a74a4b718a.0c37852b34d0418e91c62ac25af4be5b.9dbfb5598e2248d7b57eee57abf2e7c1.31.31.S-1-5-21-124525095-708259637-1543119021-565461"
There's no id like this in the comments json response - the comments "id" is a simple integer.