2

I have a photo list in sharepoint. When the individual items are viewed I make a rest api call and find the title and number of likes for that individual item.

http://sharepointsite.com/sites/sitename/pun/_api/Web/Lists/GetByTitle('List%20Name')/items?$select=Title,LikesCount

Now how can I get the status of Like(ie like/unlike) using the api query?

I could not find any column name in the list which stores the status of like for that particular user

3

There is column named LikedBy which stores the users who have liked this item.

LikedBy is lookup column (People or Group). So you have to $expand this column in your query like following

http://sharepointsite.com/sites/sitename/pun/_api/Web/Lists/GetByTitle('List%20Name')/items?$select=Title,LikesCount,LikedBy/Title&$expand=LikedBy
| improve this answer | |
  • 1
    Did you enable Rating Setting? – Atish Dipongkor - MVP Nov 17 '15 at 5:35
  • yeah its working :) – Vignesh Subramanian Nov 17 '15 at 5:37
  • in the result json, likedby is an object and not an array. Not sure how to fetch values from them – Vignesh Subramanian Nov 17 '15 at 5:39
  • I have just tested it. It's array of objects. log result in console and try again – Atish Dipongkor - MVP Nov 17 '15 at 5:41
  • Thanks. If I want to get both ID and Title of likedBy should i used LikedBy/Title,LikedBy/ID&$expand=LikedBy ? – Vignesh Subramanian Nov 17 '15 at 5:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.