圖形 API 版本

Product Feed

You must meet the following requirements to use Product Feed.

  • Your business must be listed in Business Manager
  • You must be an employee of your business, or be an employee of an Agency which is assigned to this business

閱讀中

A feed is a set of items uploaded or fetched from a source at once. You can have a single feed to represent all of the items in your catalog, or you can have multiple feeds with each feed representing a single country or single division's products

Feed Format

The Product Feed consists of a series of items in either a Tab Separated file or XML. In XML, these should exist as an array of <item>'s. In a tab separated file, the header column is required.

參數

這個端點沒有任何參數。

欄位

欄位說明
id
numeric string

ID number of the feed

country
string

An ISO 3166-1 Alpha 2 country code

created_time
datetime

The creation time of the feed

default_currency
string

Your default currency for items in a feed. If no currency is specified for items in the feed file, this value will be used

deletion_enabled
bool

This allows items to be deleted if a feed is updated and the items are not included in the new feed file

delimiter
enum {AUTODETECT, BAR, COMMA, TAB, TILDE, SEMICOLON}

The delimiter used in feed file

encoding
enum

The character encoding used by the provided feed

file_name
string

The file name of a feed. This will be overridden by name if name is present

item_sub_type
enum

The sub type of items to be uploaded by this feed

latest_upload

The latest upload session of a feed

migrated_from_feed_id
numeric string

The previous product feed id where the catalog items migrated from

name
string

The name of a feed

override_type
enum

If it is a secondary feed, this is the type of the override (country or language)

product_count
int32

The total products in a product feed

quoted_fields_mode
enum {AUTODETECT, ON, OFF}

This allows tabs and new lines within fields

schedule

The configuration for fetching the full feed in a recurrent manner. The uploads as a result of this schedule would replace the entire feed. Items missing in consequent upload feed file would be deleted

update_schedule

The configuration for fetching updates to a feed in a recurrent manner. The uploads as a result of this schedule would only update the items in the feed or create new ones with the information in the file. No items would be deleted. This is useful for sending price and availability updates for selected items in the feed

關係連線

關係連線說明

Auto markets in a feed

Automotive models in a feed

Autos in a feed

Destinations in a feed

Flights in a feed

Home listings in a feed

Hotels in a feed

Media titles in a feed

Products in a feed

rules

Concrete upload attempts

Vehicle offers in a feed

Vehicles in a feed

Error Codes

錯誤說明
100Invalid parameter

建立中

You can make a POST request to product_feeds edge from the following paths:
發佈到此關係連線時,會建立 a ProductFeed

範例

Graph API Explorer
POST /v11.0/{product-catalog-id}/product_feeds HTTP/1.1
Host: graph.facebook.com

name=Test+Feed&schedule=%7B%22interval%22%3A%22DAILY%22%2C%22url%22%3A%22http%3A%2F%2Fwww.example.com%2Fsample_feed.tsv%22%2C%22hour%22%3A%2222%22%7D
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->post(
    '/{product-catalog-id}/product_feeds',
    array (
      'name' => 'Test Feed',
      'schedule' => '{"interval":"DAILY","url":"http://www.example.com/sample_feed.tsv","hour":"22"}',
    ),
    '{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(
    "/{product-catalog-id}/product_feeds",
    "POST",
    {
        "name": "Test Feed",
        "schedule": "{\"interval\":\"DAILY\",\"url\":\"http:\/\/www.example.com\/sample_feed.tsv\",\"hour\":\"22\"}"
    },
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
Bundle params = new Bundle();
params.putString("name", "Test Feed");
params.putString("schedule", "{\"interval\":\"DAILY\",\"url\":\"http://www.example.com/sample_feed.tsv\",\"hour\":\"22\"}");
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{product-catalog-id}/product_feeds",
    params,
    HttpMethod.POST,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
NSDictionary *params = @{
  @"name": @"Test Feed",
  @"schedule": @"{\"interval\":\"DAILY\",\"url\":\"http://www.example.com/sample_feed.tsv\",\"hour\":\"22\"}",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{product-catalog-id}/product_feeds"
                                      parameters:params
                                      HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
curl -X POST \
  -F 'name="Test Feed"' \
  -F 'schedule={
       "interval": "DAILY",
       "url": "http://www.example.com/sample_feed.tsv",
       "hour": "22"
     }' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v11.0/{product-catalog-id}/product_feeds
如果想瞭解如何使用圖形 API,請參閱我們的使用圖形 API 指南

參數

參數說明
country
ISO 3166 Alpha Country Code
預設值:US

Two letter country code where the products can be sold

default_currency
ISO 4217 Currency Code
預設值:USD

The default currency used by provided feed if the currency is not specified in the feed file

deletion_enabled
boolean
預設值:true

Default value: false (to be changed to true .from API v2.5)
When true, this will remove products from a catalog that are no longer present in a feed. When false, uploading a product feed is additive and products will remain in the catalog even if they are removed from a feed. Once enabled, we do not allow this field to be disabled.

delimiter
enum {AUTODETECT, BAR, COMMA, TAB, TILDE, SEMICOLON}
預設值:AUTODETECT

Product feed delimiter

encoding
enum {AUTODETECT, LATIN1, UTF8, UTF16LE, UTF16BE, UTF32LE, UTF32BE}
預設值:AUTODETECT

The character encoding used by provided feed

feed_type
enum {AUTO, AUTOMOTIVE_MODEL, DESTINATION, FLIGHT, HOME_LISTING, HOTEL, HOTEL_ROOM, LOCAL_INVENTORY, MARKET, MEDIA_TITLE, OFFER, PRODUCTS, TRANSACTABLE_ITEMS, VEHICLE_OFFER, VEHICLES}

Type of the feed. Decides type of catalog item this feed will create

file_name
UTF-8 encoded string

The name of the product feed. .tsv, .xml or compressed files (zip, gzip and bz2) are supported

item_sub_type
enum {APPLIANCES, BABY_FEEDING, BABY_TRANSPORT, BEAUTY, BEDDING, CAMERAS, CELL_PHONES_AND_SMART_WATCHES, CLEANING_SUPPLIES, CLOTHING, CLOTHING_ACCESSORIES, COMPUTERS_AND_TABLETS, DIAPERING_AND_POTTY_TRAINING, ELECTRONICS_ACCESSORIES, FURNITURE, HEALTH, HOME_GOODS, JEWELRY, NURSERY, PRINTERS_AND_SCANNERS, PROJECTORS, SHOES_AND_FOOTWEAR, SOFTWARE, TOYS, TVS_AND_MONITORS, VIDEO_GAME_CONSOLES_AND_VIDEO_GAMES, WATCHES}

The sub type of items to be uploaded by this feed

migrated_from_feed_id
MigratedFromFeedID ID

Used to split an original feed into multiple new feeds, migrated_from_feed_id denotes the original feed's ID. Setting this field ensures that items from an original field can be migrated to a new one, without the need of deletion.
This field is generally used when splitting a large feed into multiple smaller feeds.
Example:

  1. You have a large feed called Feed A and want to split it.
  2. You create a new feed called Feed B and specify Feed A's ID under migrated_from_feed_id.
  3. You upload Feed B's catalog information, including the products you want to add to Feed B.
  4. The items from feed A have been moved to feed B. Going forward, you do not need to specify those items in Feed A and they can be removed from feed A.

name
UTF-8 encoded string

User specified name for the feed

override_type
enum {LANGUAGE, COUNTRY, CATALOG_SEGMENT_CUSTOMIZE_DEFAULT, LANGUAGE_AND_COUNTRY, LOCAL}

If this is a secondary feed, this specifies the override type of the feed

override_value
string

Override value of the feed dependent on the override type (country or language).

quoted_fields_mode
enum{autodetect, on, off}
預設值:autodetect

Whether or not there will be quotes around each field, only for TSV feeds. If this field is provided, we use it instead of the parameter quoted_fields

rules
list<JSON-encoded string>

A list of rules applied to feed uploads

schedule
JSON-encoded string

A JSON-encoded string representing a recurrent schedule for fetching the feed. Default timezone is America/Los_Angeles. Learn more about feed schedules

selected_override_fields
array<string>

Selected Override Fields of the feed, written as a list of fields which should be processed from the feed file. From whiltelisted_properties

update_schedule
JSON-encoded string

The configuration for fetching updates to a feed in a recurrent manner. The uploads would only update the items in the feed or create new ones. No items would be deleted. This is useful for sending price and availability updates for selected items in the feed. Learn more about fields in a feed schedule

傳回類型

此端點支援寫入後讀取功能,並將讀取傳回類型表示為 id 的節點。
Struct {
id: numeric string,
}

Error Codes

錯誤說明
200Permissions error
100Invalid parameter

更新中

你無法在此端點執行此操作。

刪除中

Deleting a product feed effectively disables all ads using products that come from this feed.

You can create a new feed with the same product IDs to re-enable those ads.

Examples

curl -X DELETE \
-d "access_token=<ACCESS_TOKEN>" \
https://graph.facebook.com/<API_VERSION>/<PRODUCT_FEED_ID>

你可以向 /{product_feed_id} 提出刪除要求,以刪除 a ProductFeed

參數

這個端點沒有任何參數。

傳回類型

Struct {
success: bool,
}

Error Codes

錯誤說明
100Invalid parameter
3964You must be assigned as an admin of this product feed before you can delete it.