Well, its a very broad question. I dont know what language are you using and are you aware of graph api or not. So first of all go through the basics-
- Using the Graph API
- Access token - all API calls must be signed with an access token
- Login - very important part i nfacebook integration, yet I think its not relevant to this question
- Graph API Explorer- a tool provided by facebook to test the API calls. (first register on the developers site if you have not yet)
Now coming to the solution to the question-
First of all you'll be needing the post IDs of the page. To query for all the posts-
\GET https://graph.facebook.com/<Page-ID>/posts?fields=id
Example to fetch all the public posts by "Aam Aadmi Party".
Then, for each of that post id, you have to make a POST call to /likes, this will return
true
on success and the post will be liked.\POST https://graph.facebook.com/<Post-ID>/likes
Example to like a post from the "Aam Aadmi Party" page.
Hope it helps. Good luck!