Managing Pages

With the Pages API your app can retrieve and update page information, get page posts and change page settings. To perform these actions, your app needs manage_pages permission from a user and the page access token. See Page Access Tokens and Permissions.

Page Information

Facebook Pages contain information about the Page, such as a busness location, opening hours, email, website and so on. To manage this information with the API, first read the information and then update it.

Reading Page Information

To read a Page's information, make a GET request and in the field provide a list of values for the field you want to get:

curl -F 'method=get' \
     -F 'fields=about,attire,bio,location,parking,hours,emails,website' \
      -F 'access_token={page_access_token}' \
      https://graph.facebook.com/546349135390552

On success your app receives a JSON containing the Page fields you requested:

{
  "about": "This is Mahesh's 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.maheshcafe.com", 
  "id": "546349135390552"
}

Updating Page Information

To update a Page's information, make a POST request and include the field and value you want to update:

curl -F 'method=post'
   -F 'description=This is an awesome cafe!'
   -F 'access_token={page_access_token}'
https://graph.facebook.com/546349135390552

On success, your app gets a response of true:

{
  "success": true
}

Getting Page Posts

Your app may want to retrieve a Page's post so that people can monitor and moderate posts. To get a Page's posts, make this GET request and include the post fields to retrieve:

Request: 
  curl -F 'method=get' \
       -F 'fields=id,message,from,to' \
       -F 'access_token={page_access_token}' \
    https://graph.facebook.com/546349135390552/feed

On success, your app retrieves a JSON response as follows:

{
"data": [
  {
    "id": "546349135390552_1138601292831997", 
    "message": "test", 
    "from": {
      "category": "Restaurant/cafe", 
      "category_list": [
        {
          "id": "128673187201735", 
          "name": "Coffee Shop"
        }
      ], 
      "name": "Mahesh's Cafe", 
      "id": "546349135390552"
    }, 
    "created_time": "2015-05-19T22:51:20+0000"
  }, 
 ...

Advanced Topics

The Pages API includes advanced functionality for requesting and changing Page settings.

Retrieve Roles for Page

To get a list of Page roles and people in those roles, make this request:

curl -F 'method=get' \
     -F 'access_token={page_access_token}' \
  https://graph.facebook.com/546349135390552/roles

The JSON response contains an array of people who have Page roles and the permissions they have for a Page:

{
  "roles": {
    "data": [
      {
        "id": "1270583114", 
        "name": "Mahesh Sharma", 
        "role": "Admin", 
        "perms": [
          "ADMINISTER", 
          "EDIT_PROFILE", 
          "CREATE_CONTENT", 
          "MODERATE_CONTENT", 
          "CREATE_ADS", 
          "BASIC_ADMIN"
        ]
      }, 
      {
        "id": "574628437", 
        "name": "Xiaoxiao Hou", 
        "role": "Admin", 
        "perms": [
          "ADMINISTER", 
          "EDIT_PROFILE", 
          "CREATE_CONTENT", 
          "MODERATE_CONTENT", 
          "CREATE_ADS", 
          "BASIC_ADMIN"
        ]
      },

Getting Page Reviews

Your app can retrieve all page reviews, including the name of the reviewer and the review text. To do this make this request:

curl -F 'method=get' \
     -F 'access_token={page_access_token}' \
  https://graph.facebook.com/546349135390552/rating

The response appears as follows:

{
  "data": [
    {
      "created_time": "2015-03-24T00:51:42+0000", 
      "reviewer": {
        "id": "1270583114", 
        "name": "Mahesh Sharma"
      }, 
      "rating": 4, 
      "review_text": "Hi, I had coffee there once, and it was awesome!"
    }, 
    {
      "created_time": "2014-06-11T01:47:47+0000", 
      "reviewer": {
        "id": "100002961356979", 
        "name": "Jignesh Kumar"
      }, 
      "rating": 2, 
      "review_text": "From Jignesh"
    }
  ], 
  "paging": {ereifgndbgrguflehccbjkblhrfkhutd
    "cursors": {
      "before": "MTI3MDU4MzExNDo1NDYzNDkxMzUzOTA1NTI=", 
      "after": "MTAwMDAyOTYxMzU2OTc5OjU0NjM0OTEzNTM5MDU1Mg=="
    }
  }
}

Block Person from Page

There are cases where people may want to block a person from commenting on their Page. To do this, your app needs the id of the reviewer and then makes this request:

curl -F 'method=post' \
     -F 'user=[1270583114, 100002961356979]' \
     -F 'access_token={access_token}' \
  https://graph.facebook.com/546349135390552/blocked

On success your app gets this response:

{
  "100002961356979": true,
  "1270583114": true
}

Update Page Settings

To update a Page's setting make a POST request to {page-id}/settings. In this example we change the blacklisted countries which will not access this page:

curl -F 'method=post'
     -F 'option={"COUNTRY_RESTRICTIONS" : {"restriction_type":"blacklist", "countries":["PL", "FR"]}}'
     -F 'access_token={page_access_token}'
  https://graph.facebook.com/546349135390552/settings

On success, your app receives this response:

{
  "success": true
}