Graph API Version

/{app-id}/app_link_hosts

The app link objects created by this app. Read more about what App Links are at our applinks.org site.

Reading

Graph API Explorer
GET /v2.11/app/app_link_hosts 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(
    '/app/app_link_hosts',
    '{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 */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/app/app_link_hosts",
    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:@"/app/app_link_hosts"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

  • An app access token for the app is required.

Response

A list of App Link Host objects is returned.

Publishing

Facebook apps can create app links using this edge:

/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->post(
    '/app/app_link_hosts',
    array (
      'name' => 'Example App Link Host Name',
      'windows_phone' => '[{"url": "test://activate" },{"url": "test://deactivate"}]',
      'web' => '{"should_fallback": false}',
    ),
    '{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 */
POST /v2.11/app/app_link_hosts HTTP/1.1
Host: graph.facebook.com

name=Example+App+Link+Host+Name&windows_phone=%5B%7B%22url%22%3A+%22test%3A%2F%2Factivate%22+%7D%2C%7B%22url%22%3A+%22test%3A%2F%2Fdeactivate%22%7D%5D&web=%7B%22should_fallback%22%3A+false%7D

Permissions

  • An app access token is required to create app link hosts belonging to that app.

Fields

NameDescriptionType

name

A custom name for this app link host. This field is required.

string

ios

An array of app links to define for the iOS platform.

object[]

app_name

The native app's name in the iTunes store.

string

app_store_id

The native app's ID in the iTunes store.

string

url

The native iOS URL that will be navigated to. This field is required if using ios.

string

iphone

An array of app links to define for iPhones.

object[]

app_name

The native app's name in the iTunes store.

string

app_store_id

The native app's ID in the iTunes store.

string

url

The native iOS URL that will be navigated to. This field is required if using iphone.

string

ipad

An array of app links to define for iPads.

object[]

app_name

The native app's name in the iTunes store.

string

app_store_id

The native app's ID in the iTunes store.

string

url

The native iOS URL that will be navigated to. This field is required if using ipad.

string

android

An array of app links to define for the Android platform.

object[]

app_name

The native app's name in the Android store.

string

class

The fully classified class name of the app for intent generation.

string

package

The fully classified package name of the app for intent generation.

string

url

The native Android URL that will be navigated to. This field is required if using android.

string

windows_phone

An array of app links to define for the Windows Phone platform.

object[]

app_id

The native app's id in the Windows Phone store.

string

app_name

The native app's name in the Windows Phone store.

string

url

The native Windows Phone URL that will be navigated to. This field is required if using windows_phone.

string

web

The web redirect to use when the app link URL is loaded in a browser.

object

should_fallback

Determines whether the web link should be used if the native links don't work. Default is true if not supplied.

bool

url

The web URL for this app link.

string

Response

If successful:

NameDescriptionType

id

The id of the new app link host.

string

Otherwise an error message.

Deleting

You can delete an app link host object using the /app-link-host node.

Updating

You can update an app link host object using the /app-link-host node.