Graph API Version

Native Offer

Reading

A native offer represents an Offer on Facebook. The /{offer_id} node returns a single native offer. Each native offer requires a view to be rendered to users.

Examples

Graph API Explorer
GET /v2.9/{native-offer-id} HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'GET',
  '/{native-offer-id}'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
/* make the API call */
FB.api(
    "/{native-offer-id}",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{native-offer-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:@"/{native-offer-id}"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
If you want to learn how to use the Graph API, read our Using Graph API guide.

Parameters

This endpoint doesn't have any parameters.

Fields

FieldDescription

id

numeric string

The id of the native offer.

barcode_photo

string

Barcode image ID for in-store redemption.

barcode_photo_uri

string

Barcode image URI for in-store redemption.

barcode_type

string

Barcode type for in-store redemption.

barcode_value

string

Barcode value for in-store redemption.

details

string

Additional primary text describing the native offer.

disable_location

bool

Whether or not the location features, such as the map and nearby notification, are disabled.

discounts

list<NativeOfferDiscount>

A structured representation of each part of the deal.

expiration_time

datetime

The time when the native offer expires, as a UNIX timestamp. After this time, the native offer will not be available for users to save.

instore_code

string

The code used to redeem the native offer in-store.

location_type

enum

Where the offer may be redeemed. Valid values are online, offline, and both.

max_save_count

integer

The maximum number of users who may save the native offer. A value of 0 means an unlimited number of saves are allowed.

online_code

string

The code used to redeem the native offer online.

page

The id of the page that owns the native offer.

redemption_link

string

The URL where the native offer may be redeemed.

save_count

integer

Number of users who have saved the native offer.

terms

string

Limitations, terms and conditions on the use of the native offer.

title

string

The title of the native offer

total_unique_codes

string

Number of the unique codes/barcodes uploaded

unique_codes

string

The fileId of the unique codes/barcodes file

unique_codes_file_code_type

string

Code type of the unique codes/barcodes uploaded

unique_codes_file_name

string

Name of the unique codes/barcodes uploaded

unique_codes_file_upload_status

string

The uploaded status of the unique codes/barcodes file

Edges

EdgeDescription

views

Multiple creative views of this native offer.

Validation Rules

ErrorDescription
262Incorrect permission to publish pages
100Invalid parameter

Creating

You can make a POST request to nativeoffers edge from the following paths:
When posting to this edge, a NativeOffer will be created.

Parameters

NameDescription
barcode_type
enum {CODE128, CODE128B, EAN, PDF417, QR, UPC_A, UPC_E, DATAMATRIX, CODE93}

Barcode type for in-store offers.

barcode_value
string

Barcode value for in-store offers.

details
Base64 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
type
enum {percentage_off, free_stuff, cash_discount, bogo}
Required
text
string
value1
float
value2
float
currency
ISO 4217 Currency Code
override
string
Default value:
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.

redemption_link
URL

The URL to the site where a user can redeem the offer.

terms
Base64 UTF-8 encoded string

Limitations, terms and conditions on the use of the native offer.

Return Type

This endpoint supports read-after-write and will read the node represented by id in the return type.
Struct {
id: numeric string,
}
You can make a POST request to nativeofferviews edge from the following paths:
When posting to this edge, a NativeOffer will be created.

Parameters

NameDescription
ad_account
numeric string or integer

Optional ID of an ad account, matched to the ad_image_hashes.

ad_image_hashes
list<string>

Optional array of ad image hashes, matched to the ad_account. Only one of ad_image_hashes, photos, urls, and multipart attachments should be specified.

carousel_captions
list<string>

Optional array of strings to be used as carousel captions.Makes carousel_links a required field; the number of items in each array must also match.

carousel_links
list<string>

Optional array of urls to be used as carousel captions.Makes carousel_captions a required field; the number of items in each array must also match.

image_crops
list<dictionary { enum{191x100, 100x72, 400x150, 600x360, 100x100, 400x500} : <list<list<int64>>> }>

Optional array of image crop parameters

message
string

The main body of the post, otherwise called the status message. Required if either published_ads or published is true.

photos
list<numeric string or integer>

Optional array containing IDs of existing Photo objects. Only one of ad_image_hashes, photos, urls, and multipart attachments should be specified.

published
boolean

Whether to create and show a story about this native offer view. Only one of published_ads and published should be specified.

published_ads
boolean

Whether to create a story for use in ads. Only one of published_ads and published should be specified.

urls
list<URL>

Optional array of URLs for publicly accessible photos.Only one of ad_image_hashes, photos, urls, and multipart attachments should be specified.

videos
list<numeric string or integer>

Optional array of IDs for videos already owned by the page. Currently only one video is allowed per view.

Return Type

This endpoint supports read-after-write and will read the node to which you POSTed.
Struct {
success: bool,
native_offer_view: numeric string,
post: numeric string,
photos: List [
numeric string
],
videos: List [
numeric string
],
}
You can make a POST request to codes edge from the following paths:
When posting to this edge, a NativeOffer will be created.

Parameters

NameDescription
file
file

A csv/txt formatted file that contains unique offer codes. Each code can be claimed by a single user. The file needs to follow a few rules: 1) One unique code per line, 2) 20 or less characters per code with no spaces, 3) Only letters, numbers, dashes or underscores allowed, 4) Up to 10,000 unique codes per file

unique_codes_file_code_type
enum {discount_codes, barcodes, online_discount_codes, instore_discount_codes, instore_barcodes, discount_and_barcodes, discount_and_discount}
Default value: discount_codes

The type of file being uploaded

Return Type

This endpoint supports read-after-write and will read the node to which you POSTed.
Struct {
success: bool,
}

Validation Rules

ErrorDescription
100Invalid parameter

Updating

You can't perform this operation on this endpoint.

Deleting

You can't perform this operation on this endpoint.