This document refers to a feature that was removed after Graph API v3.2.
Graph API Version

Graph API Reference /{page-id}/videos

There are two similar edges described here:

  • /{page-id}/videos shows all videos this page is tagged in.
  • /{page-id}/videos/uploaded shows all videos that were published to Facebook by this page.

Both of these edges share the exact same API structure, permissions and fields, but we will only describe /videos below.

Related Guides

Reading

Graph API Explorer
GET /v12.0/{page-id}/videos HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get(
    '/{page-id}/videos',
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "/{page-id}/videos",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{page-id}/videos",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{page-id}/videos"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

  • Any valid access token is required to view a Page's videos.

Fields

An array of Video objects.

Publishing

Videos must be encoded as multipart/form-data and published to graph-video.facebook.com instead of the regular Graph API URL.

POST /v12.0/{page-id}/videos HTTP/1.1
Host: graph-video.facebook.com

source=%7Bvideo-data%7D
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->post(
    '/{page-id}/videos',
    array (
      'source' => '{video-data}',
    ),
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "/{page-id}/videos",
    "POST",
    {
        "source": "{video-data}"
    },
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
Bundle params = new Bundle();
params.putString("source", "{video-data}");
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{page-id}/videos",
    params,
    HttpMethod.POST,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
NSDictionary *params = @{
  @"source": @"{video-data}",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{page-id}/videos"
                                      parameters:params
                                      HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

We support the following formats for uploaded videos:

3g2, 3gp, 3gpp, asf, avi, dat, divx, dv, f4v, flv, m2ts, m4v, mkv, mod, mov, mp4, mpe, mpeg, mpeg4, mpg, mts, nsv, ogm, ogv, qt, tod, ts, vob, wmv.

The aspect ratio of the video must be between 9x16 and 16x9, and the video cannot exceed 1024MB or 20 minutes in length (this limit is 100MB or 10 minutes for un-verified users).

Permissions

  • A page access token with publish_pages permission can be used to publish new videos.

Fields

NameDescriptionType

source

The video, encoded as form data. This field is required.

multipart/form-data

description

The description of the video, used as the accompanying status message in any feed story. This parameter can contain mentions of other Facebook Pages using the following syntax:

@[page-id]

For example the following description would mention the Facebook Developers page inline:

Test message @[19292868552] tag

Usage of this feature is subject to review but by using Pages you are an admin of (both to make the API call, and to be used in a mention), and an app you are a developer of, you can test it for yourself before review.

string

title

The title of the video.

string

targeting

Object that limits the audience for this content. Anyone not in these demographics will not be able to view this content. This will not override any Page-level demographic restrictions that may be in place.

object

countries

Values of targeting countries. You can specify up to 25 countries. Use ISO 3166 format codes.

string[]

locales

Targeted locales. Use type of adlocale to find Targeting Options and use the returned key to specify.

int[]

age_max

Maximum age

int

age_min

Must be 13 or higher. Default is 0

int

feed_targeting

Object that controls news feed targeting for this content. Anyone in these groups will be more likely to see this content, those not will be less likely, but may still see it anyway. Any of the targeting fields shown here can be used, none are required.

object

age_max

Maximum age

int

age_min

Must be 13 or higher. Default is 0

int

cities

Values of targeting cities. Use type of adcity to find Targeting Options and use the returned key to specify.

int[]

college_majors

Target people who majored in these college subjects. Limited to 200 college major values. Use type of adcollegemajor to find Targeting Options and use the returned name to specify.

string[]

college_networks

Colleges, for college graduates. Limit is 200 values.

object[]

id

Unique ID of targeted college. Use type of adcollege to find Targeting Options and use the returned key to specify.

int

college_years

Array of integers for graduation year from college.

int[]

countries

Values of targeting countries. You can specify up to 25 countries. Use ISO 3166 format codes.

string[]

education_statuses

Array of integers for targeting based on education level. Use 1 for high school, 2 for undergraduate, and 3 for alum (or localized equivalents).

int[]

genders

Target specific genders. 1 targets all male viewers and 2 females. Default is to target both.

int[]

interested_in

Indicates targeting based on the 'interested in' field of the user profile. You can specify an integer of 1 to indicate male, 2 indicates female. Default is all types. Please note 'interested in' targeting is not available in France due to local laws.

int[]

locales

Targeted locales. Use type of adlocale to find Targeting Options and use the returned key to specify.

int[]

regions

Values of targeting regions. Use type of adregion to find Targeting Options and use the returned key to specify.

int[]

relationship_statuses

Array of integers for targeting based on relationship status. Use 1 for single, 2 for 'in a relationship', 3 for married, and 4 for engaged. Default is all types.

int[]

work_networks

Company, organization, or other workplace.

object[]

name

Name of targeted workplace. Use type of adworkplace to find Targeting Options and use the returned name to specify this.

string

id

Unique ID of targeted workplace. Use type of adworkplace to find Targeting Options and use the returned key to specify this (must match paired name value).

int

published

Whether a post about this video is published. Default is true.

bool

scheduled_publish_time

Time when the page post about this video should go live, this should be between 10 mins and 6 months from the time of publishing the video.

timestamp

Response

If successful:

NameDescriptionType

id

The newly created video ID

string

Deleting

You can't delete using this edge.

Updating

You can't update using this edge.