Prerequisites: Facebook API Set-1, Set-2, Set-3
In this article we will be discussing 3 methods :
- put_object
- put_like
- put_comment
- put_object: Writes the mentioned object to the Facebook Social Graph connected to the given parent.
Parameters:- parent_object: A string specifying the parent of the new object. For example- Post is the parent of comment, when we want to add a new comment or when we want to add a new photo, User profile is the parent of the photo.
- connection name: A string specifying the connection or edges between the objects.
Example#1: Post a message with a link to the active user wall.
importjsonimportfacebookÂÂdefmain():   Âtoken="Please replace this with "me"oryour Access Token(forPosting on your wall)\            Âorwith PAGE Access Token(forposting on Page)"   Âgraph=facebook.GraphAPI(token)   Âmessage=graph.put_object(parent_object="me",             Âconnection_name="feed",             Âmessage="Hello this is a great website for various Computer Science Topics.",   Âprint(json.dumps(message, indent=4))ÂÂif__name__=='__main__':   Âmain()Example#2: This example shows how to use put_object to post a comment to a POST.
importjsonimportfacebookÂÂdefmain():   Âtoken="Please replace this with your PAGE ACCESS TOKEN"   Âgraph=facebook.GraphAPI(token)commenttopost=graph.put_object(parent_object="PAGEID_POSTID",               Âconnection_name="comments",               Âmessage="Please share and Like the website for content on Computer Science")   Âprint(json.dumps(commenttopost, indent=4))ÂÂif__name__=='__main__':   Âmain() - put_comment: This methods facilitates to write a message as comment to an object.
Parameters:- object_id: A string unique for a particular resource.
- message: A string to be posted as comment.
importjsonimportfacebookÂÂdefmain():   Âtoken="Please replace this with your PAGE ACCESS TOKEN"   Âgraph=facebook.GraphAPI(token)   Âputcomment=graph.put_comment(object_id="PAGEID_POSTID",                Âmessage="This is a very good website for Computer Science Topics")   Âprint(json.dumps(putcomment, indent=4))ÂÂif__name__=='__main__':   Âmain() - put_like: Add like to a given object
Parameters:
object_id: A string that is a unique id for the particular resource.importjsonimportfacebookÂÂdefmain():Â Â Â Âtoken="Please replace this with your PAGE ACCESS TOKEN"Â Â Â Âgraph=facebook.GraphAPI(token)Â Â Â Âputlike=graph.put_like(object_id="PAGEID_POSTID")Â Â Â Âprint(json.dumps(putlike, indent=4))ÂÂif__name__=='__main__':Â Â Â Âmain()
References: https://facebook-sdk.readthedocs.io/en/latest/api.html

