With the Pages API your app can get and update page information, and change page settings.
You will need:
CREATE_CONTENT
, MANAGE
, or MODERATE
task on the PageSend a GET
request to /{user-id}/accounts
endpoint:
curl -i -X GET "https://graph.facebook.com/{user-id}/accounts ?access_token={user-access-token}"
On success, your app will receive the following response:
{ "data": [ { "access_token": "{facebook-for-developers-page-access-token}", "category": "Internet Company", "category_list": [ { "id": "2256", "name": "Internet Company" } ], "name": "Facebook for Developers", "id": "{facebook-for-developers-page-id}", "tasks": [ "ANALYZE", "ADVERTISE", "MODERATE", "CREATE_CONTENT" ] }, { "access_token": "{my-outlandish-stories-page-access-token}", "category": "Blogger", "category_list": [ { "id": "361282040719868", "name": "Blogger" } ], "name": "My Outlandish Stories", "id": "{my-outlandish-stories-page-id}", "tasks": [ "ANALYZE", "ADVERTISE", "MODERATE", "CREATE_CONTENT", "MANAGE" ] }, { "access_token": "{princess-fables-page-access-token}", "category": "Blogger", "category_list": [ { "id": "361282040719868", "name": "Blogger" } ], "name": "Princess Fables", "id": "{princess-fables-page-id}", "tasks": [ "MODERATE" ] }, ...
You will need:
MANAGE
task on the Pagebusiness_management
permission is required.Send a GET
request to the {page-id}/roles{tasks}
endpoint:
curl -i -X GET "https://graph.facebook.com/{page-id} ?fields=roles{tasks} &access_token={page-access-token}"
On success, your app receives the following response:
{ "roles": { "data": [ { "name": "Jean-Paul Jeanne", "id": "{user-id}", "tasks": [ "ANALYZE" ] }, { "name": "Kelly Hoover", "id": "{user-id}", "tasks": [ "ANALYZE", "ADVERTISE", "MODERATE", "CREATE_CONTENT", "MANAGE" ] } ], } }
For people who can perform tasks on your Page, you will need:
MANAGE
task on the PageFor people who do not manage the Page being queried, you will need:
Send a GET
request to the /{page-id}
endpoint with the Page fields you would like to view:
curl -i -X GET "https://graph.facebook.com/{page-id} ?fields=about,attire,bio,location,parking,hours,emails,website &access_token={page_access_token}"
On success, your app receives the following response:
{ "about": "This a Cafe!", "location": { "city": "Menlo Park", "country": "United States", "latitude": 37.482266, "longitude": -122.150546, "state": "CA", "street": "1601 Willow Rd", "zip": "94025" }, "parking": { "lot": 1, "street": 0, "valet": 0 }, "emails": [ "hi@hello.com" ], "website": "http://www.cafe.com", "id": "{page-id}" }
Note, if a field is not returned in the response, the Page does not have this value set. For example, if the Page has not set the attire
field, this field will not be returned in the response.
You can update details on a Page, such as phone, email, or hours of operation.
For people who can perform tasks on your Page, you will need:
MANAGE
task on the PageSend a POST
request to the /{page-id}
endpoint with the field and value you want to update:
curl -i -X POST "https://graph.facebook.com/{page-id} ?about=This is an awesome cafe located downtown! &access_token={page_access_token}"
On success, your app will receive the following response:
{ "success": true }
Page About Story is deprecated for v8.0 or later. Please see the Graph API Changelog for more information.
For people who own or manage the Page being queried, you will need:
MANAGE
the Page.For people who do not own or manage the Page being queried, you will need:
Only people who own or manage the Page can create a Page About Story.
Send a POST
request to the /{page-id}/page_about_story
endpoint with parameters to set the title, the story text, and to publish the story:
curl -i -X POST "https://graph.facebook.com/{page-id}/page_about_story ?title=My Title &composed_text=[{text:My Story text., type:UNSTYLED, depth:0}] &is_published=true &access_token={page-access-token}"
On success, your app receives the following response:
{ "page_about_story_id": "{page-story-id}" }
Send a POST
request to the /{page-id}/page_about_story
endpoint with parameters to set the title, the story text with style elements, and to publish the story.
curl -i -X POST "https://graph.facebook.com/{page-id}/page_about_story ?title=My Story Title &composed_text=[ { "text":"My Facebook Story text.", "type":"UNSTYLED", "depth": 0, "inline_style_ranges": [ { "offset": 12, "length": 5, "style": "ITALIC" } ] } ] &is_published=true &access_token={page-access-token}"
On success, your app receives the following response:
{ "page_about_story_id": "{page-story-id}" }
![]() | ... "composed_text": [ { "text": "Hello, this is the story of my cats:", "type": "UNSTYLED", "depth": 0, "inline_style_ranges": [{"offset": 28, "length": 7, "style": "ITALIC"}] }, { "text": "Ash, who is black with black stripes", "type": "UNORDERED_LIST_ITEM", "depth": 1, "inline_style_ranges": [{"offset": 0, "length": 3, "style": "BOLD"}, {"offset": 18, "length": 4, "style": "ITALIC"}] }, { "text": "Cinder, who is black with black stripes", "type": "UNORDERED_LIST_ITEM", "depth": 1, "inline_style_ranges": [{"offset": 0, "length": 6,"style": "BOLD"}, {"offset": 21, "length": 4, "style": "ITALIC"}] }, { "text": "I adopted them from the Silicon Valley Humane Society.", "type": "UNSTYLED", "depth": 0, "entity_ranges": [{"offset": 24, "length": 29, "key": "0"}] }, { "text": "�", "type": "MEDIA", "depth": 0, "entity_ranges": [{"offset": 0, "length": 1,"key": "1"}] } ], "entity_map": [ { "key": "1", "type": "IMAGE", "data": [{"key": "id", value": "1889355891120271"}, {"key": "src", "value": "location-of-the-image-uploaded-to-facebook"}, {"key": "caption", "value": "This is Cinder being lazy."}, {"key": "height", "value": "720"}, {"key": "width", "value": "960"}, {"key": "size", "value": "COLUMN"}, {"key": "float"}] }, { "key": "0", "type": "LINK", "data": [{"key": "url", "value": "http://www/svhs.com"}, {"key": "shimmedURL", "value": "https://..."}] } ] ... |
Send a GET
request to the /{page-id}
endpoint with the page_about_story
field:
curl -i -X GET "https://graph.facebook.com/{page-id} ?fields=page_about_story &access_token={access-token}"
On success, your app receives the following response:
{ "page_about_story": { "id": "{page-about-story-id}", "page_id": "{page-id}", "is_published": true, "title": "My Story Title", "composed_text": [ { "text": "My Story text.", "type": "UNSTYLED", "depth": 0 } ] }, "id": "{page-id}" }
Only people who own or manage the Page can update a Page About Story.
Send a POST
request to the /{page-story-id}
endpoint with the parameters you would like to update:
curl -i -X POST "https://graph.facebook.com/{page-story-id} ?composed_text=[{"text": "My longer story text."}] &access_token={page-access-token}"
On success, your app receives the following response:
{ "id": "{page-story-id}" }
Only people who own or manage the Page can delete a Page About Story.
Send a DELETE
request to the /{page-story-id}
endpoint where {page-story-id}
is the ID of the Page Story you want to delete:
curl -i -X DELETE "https://graph.facebook.com/{page-story-id} ?access_token={page-access-token}"
On success, your app receives the following response:
{ "success": true }
page_about_story Parameters | Description |
---|---|
composed_text JSON array,Required | The text, image, etc. of your story, including styling. |
cover_photo dictionary, optional | The cover photo of your Page About Story.
|
entity_map | Description of an entity map. array, optional |
is_published | Returns if the Page About Story is published or not. boolean, optional |
title | The title of your Page About Story. string, optional |
You can update the settings of a Page, such as allowing visitors to post to your Page, message your Page, or age or country restrictions.
You will need:
pages_manage_metadata
permissionMANAGE
task on the Page that is being queriedSend a POST
request to the {page-id}/settings
edge with the option
you want to update:
curl -i -X POST "https://graph.facebook.com/{page-id}/settings ?option={USERS_CAN_MESSAGE: true} &access_token={page-access-token}"
On success, your app will receive the following response:
{ "success": true }
You can get all ratings and reviews for a Page, including the name of the reviewer and the review text.
You will need:
pages_read_user_content
permissionCREATE_CONTENT
, MANAGE
, or MODERATE
task on the Page that is being queriedBeginning August 17, 2018 we are introducing a new ratings
parameter that captures recommendations, recommendation_type
with values of positive
or negative
. This new parameter is replacing the rating
parameter with its 1 to 5 scale. Ratings created after August 13 will use this new parameter.
Send a GET
request to the /{page-id}/ratings
endpoint:
curl -i -X GET "https://graph.facebook.com/{page-id} ?fields=ratings{open_graph_story,recommendation_type,has_review} &access_token={page-access-token}"
{ "data": [ { "open_graph_story": { "start_time": "2018-07-07T04:35:18+0000", "type": "sellers.rates", "data": { "rating": { "value": 5, "scale": 5 }, "is_hidden": false, "seller": { "id": "130533530354972", "title": "Jasper's Market", "type": "seller", "url": "https://www.facebook.com/JaspersMarket/" } }, "id": "10150030749305470" }, "created_time": "2018-07-07T04:35:18+0000", "rating": 5, "has_rating": true, "has_review": false, "recommendation_type": "positive" } ] }
{ "data": [ { "open_graph_story": { "start_time": "2018-07-07T04:35:18+0000", "type": "sellers.rates", "data": { "is_hidden": false, "seller": { "id": "130533530354972", "title": "Jasper's Market", "type": "seller", "url": "https://www.facebook.com/JaspersMarket/" } }, "id": "10150030749305470" }, "created_time": "2018-07-07T04:35:18+0000", "has_rating": false, "has_review": false, "recommendation_type": "positive" } ] }
You can block a person from commenting on a Page.
You will need:
pages_manage_engagement
permissionpages_read_user_content
permissionCREATE_CONTENT
, MANAGE
, or MODERATE
task on the Page that is being queriedSend a POST
request to the /{page-id}blocked
endpoint with the ID of the person you want to block:
curl -i -X POST "https://graph.facebook.com/{page-id}/blocked ?user={user-id-to-block} &access_token={page-access-token}"
On success, your app receives the following response:
{ "{user-id-to-block}": true }