图谱 API 版

Product Catalog Product Feed

Products feeds associated with a catalog. See Dynamic Ads, Catalog Setup. For example, get a list of all product feeds:

curl -G \
-d "access_token=<ACCESS_TOKEN>" \
https://graph.facebook.com/<API_VERSION>/<PRODUCT_CATALOG_ID>/product_feeds

Or get a list of product items in a product feed:

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

读取

例子

Graph API Explorer
GET /v19.0/{product-catalog-id}/product_feeds 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(
    '/{product-catalog-id}/product_feeds',
    '{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",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{product-catalog-id}/product_feeds",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{product-catalog-id}/product_feeds"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
如果你希望详细了解如何使用图谱 API,请阅读我们的图谱 API 指南

参数

这个端点不包含任何参数。

字段

从这条连线读取将返回一个 JSON 格式的结果:

{ "data": [], "paging": {} }

data

ProductFeed 节点列表。

paging

详细了解分页功能,请见图谱 API 指南

错误代码

错误描述
100Invalid parameter
190Invalid OAuth 2.0 Access Token
200Permissions error

创建

你可以通过下列路径向 product_feeds 连线发出 POST 请求:
发布到这个连线时,将会创建 a ProductFeed

例子

Graph API Explorer
POST /v19.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/v19.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 {AUTOMOTIVE_MODEL, DESTINATION, FLIGHT, HOME_LISTING, HOTEL, HOTEL_ROOM, LOCAL_INVENTORY, 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

ingestion_source_type
enum {PRIMARY_FEED, SUPPLEMENTARY_FEED}

ingestion_source_type to decide type of feed i.e. primary or supplementary

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, VERSION, CATALOG_SEGMENT_CUSTOMIZE_DEFAULT, LANGUAGE_AND_COUNTRY, BATCH_API_LANGUAGE_OR_COUNTRY, SMART_PIXEL_LANGUAGE_OR_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).

primary_feed_ids
list<primary Batch API session container/primary partner integration session container/primary product feed ID>

primary_feed_ids to which a supplementary feed should be linked

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,
}

错误代码

错误描述
100Invalid parameter
200Permissions error
190Invalid OAuth 2.0 Access Token

更新

你无法在此端点执行该操作。

删除

你无法在此端点执行该操作。