Graph API Version

Milestone /{milestone-id}

This represents a milestone on a Facebook Page. The /{milestone-id} node returns a single 'milestone'.

Related Guides

Reading

Graph API Explorer
GET /v2.9/{milestone-id} HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'GET',
  '/{milestone-id}'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
/* make the API call */
FB.api(
    "/{milestone-id}",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{milestone-id}",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{milestone-id}"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

  • Any valid app or user access token is needed to view publicly shared milestones.
  • A page access token is required to view any other milestones.

Fields

NameDescriptionType

id

The ID of a milestone event

string

title

The title of the milestone

string

from

The Page that posted the milestone.

Page

description

The description of the milestone

string

created_time

The creation time of the milestone

datetime

updated_time

The update time of the milestone

datetime

start_time

The start time of the milestone

datetime

end_time

The end time of the milestone. Page milestones have the same start and end time

datetime

Publishing

Use the /{page-id}/milestones edge to create new milestones for a Page.

To do this you need the publish_pages permission.

Deleting

You can delete an existing milestone by updating on this node. To do this you need the publish_pages permission.

DELETE /v2.9/{milestone-id} HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'DELETE',
  '/{milestone-id}'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
/* make the API call */
FB.api(
    "/{milestone-id}",
    "DELETE",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{milestone-id}",
    null,
    HttpMethod.DELETE,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{milestone-id}"
                                      parameters:params
                                      HTTPMethod:@"DELETE"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

Fields

No fields necessary to delete.

Response

If successful:

{
  "success": true
}

Otherwise a relevant error message will be returned.

Updating

You can update an existing milestone by updating on this node. To do this you need the publish_pages permission.

POST /v2.9/{milestone-id} HTTP/1.1
Host: graph.facebook.com

title=New+Title&description=New+description&start_time=2012-02-29T07%3A00%3A00%2B0000
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'POST',
  '/{milestone-id}',
  array (
    'title' => 'New Title',
    'description' => 'New description',
    'start_time' => '2012-02-29T07:00:00+0000',
  )
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
/* make the API call */
FB.api(
    "/{milestone-id}",
    "POST",
    {
        "title": "New Title",
        "description": "New description",
        "start_time": "2012-02-29T07:00:00+0000"
    },
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
Bundle params = new Bundle();
params.putString("title", "New Title");
params.putString("description", "New description");
params.putString("start_time", "2012-02-29T07:00:00+0000");
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{milestone-id}",
    params,
    HttpMethod.POST,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
NSDictionary *params = @{
  @"title": @"New Title",
  @"description": @"New description",
  @"start_time": @"2012-02-29T07:00:00+0000",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{milestone-id}"
                                      parameters:params
                                      HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

Fields

NameDescriptionType

title

The title of the milestone.

string

description

The description of the milestone.

string

start_time

The start time of the milestone. This will also update the end_time value.

datetime

Response

If successful:

{
  "success": true
}

Otherwise a relevant error message will be returned.

Edges

NameDescription

/likes

A list of the likes.

/comments

A list of the comments.