Page Offers
Offers for a Facebook Page such as a rebate for purchasing from the Page's business.
Edge to get native offers owned by the page.
You will need the following:
ADVERTISE
task on the Page.pages_manage_ads
permissionIf a person is not able to perform the task on the Page, you will need the following:
Name | Description |
---|---|
Page Public Content Access | This feature permission may be required. |
GET /v9.0/{page-id}/nativeoffers 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}/nativeoffers',
'{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}/nativeoffers",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{page-id}/nativeoffers",
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:@"/{page-id}/nativeoffers"
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
Reading from this edge will return a JSON formatted result:
{ "
data
": [], "paging
": {} }
data
paging
Error | Description |
---|---|
200 | Permissions error |
nativeoffers
edge from the following paths: You will need the following:
ADVERTISE
task on the Page.pages_manage_ads
permissionParameter | Description |
---|---|
barcode_type enum {CODE128, CODE128B, CODE93, DATABAR, DATABAR_EXPANDED, DATABAR_EXPANDED_STACKED, DATABAR_LIMITED, DATAMATRIX, EAN, PDF417, QR, UPC_A, UPC_E} | Barcode type for in-store offers. |
barcode_value string | Barcode value for in-store offers. |
details UTF-8 encoded string | Additional primary text describing the native offer. Required |
disable_location boolean | Whether or not to disable location features, such as the map and nearby notification. |
discounts list<Object> | An array of OfferDiscount objects. Required |
expiration_time datetime | The unix time representing when the offer expires. Required |
instore_code string | The code used to redeem the native offer in-store. This code should not contain any spaces. |
location_type enum {online, offline, both} | Default value: online A OfferAvailabilityLocation enum value. |
max_save_count int64 | Default value: 0 Maximum number of allowed saves, 0 is unlimited. |
online_code string | The code used to redeem the native offer online. This code should not contain any spaces. |
page_set_id numeric string or integer | The ID of Place Page Set which represents the locations where this in-store offer is valid for. |
redemption_link URL | The URL to the site where a user can redeem the offer. |
terms UTF-8 encoded string | Limitations, terms and conditions on the use of the native offer. |
id
in the return type.id
: numeric string, Error | Description |
---|---|
100 | Invalid parameter |
2831 | This offer requires a redemption_link URL. |