product_sets
edge from the following paths: POST /v21.0/<PRODUCT_CATALOG_ID>/product_sets HTTP/1.1
Host: graph.facebook.com
name=Test+Set&filter=%7B%22product_type%22%3A%7B%22i_contains%22%3A%22shirt%22%7D%7D
/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->post(
'/<PRODUCT_CATALOG_ID>/product_sets',
array (
'name' => 'Test Set',
'filter' => '{"product_type":{"i_contains":"shirt"}}',
),
'{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_sets",
"POST",
{
"name": "Test Set",
"filter": "{\"product_type\":{\"i_contains\":\"shirt\"}}"
},
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
Bundle params = new Bundle();
params.putString("name", "Test Set");
params.putString("filter", "{\"product_type\":{\"i_contains\":\"shirt\"}}");
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/<PRODUCT_CATALOG_ID>/product_sets",
params,
HttpMethod.POST,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
NSDictionary *params = @{
@"name": @"Test Set",
@"filter": @"{\"product_type\":{\"i_contains\":\"shirt\"}}",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/<PRODUCT_CATALOG_ID>/product_sets"
parameters:params
HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
curl -X POST \
-F 'name="Test Set"' \
-F 'filter={
"product_type": {
"i_contains": "shirt"
}
}' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v21.0/<PRODUCT_CATALOG_ID>/product_sets
Parameter | Description |
---|---|
filter A JSON-encoded rule | Filter rules to define a product set (max length: 500 KiB) |
metadata JSON object | Product set metadata, which can be used for creating product collections |
name UTF-8 encoded string | Name of the product set Required |
publish_to_shops array<JSON object> | Shop ids where this product set should be published as collection. |
retailer_id UTF-8 encoded string | External product set retailer id |
id
in the return type.id
: numeric string, Error | Description |
---|---|
100 | Invalid parameter |
10803 | Product set with the same filters already exists |
200 | Permissions error |
368 | The action attempted has been deemed abusive or is otherwise disallowed |
Creating a product set with an empty filter
parameter indicates that all items in the product catalog should be in the set. Each rule is a JSON-encoded string. An empty filter
parameter can be specified using either an empty parameter value or an empty JSON object, {}
.
Recommendation: Query with content type application/json
.
contains
operators can only be used for string matching when creating product sets. For enum
values use the eq
operators.i_*
operators can still be used.For a full list of limitations and examples, along with useful tips about how to use punctuation characters to create and manage product sets, see this Business Help Center article
Filter rules are made up of the following fields and operators:
Field | Description |
---|---|
| The demographic of an item. There are only 5 accepted values: |
| Unique ID of the agent. |
| The availability of the product item, home listing, or vehicle. Predefined values for products: |
| The base price per night for a hotel. You must specify the value with currency. |
| The body style of a vehicle. Supported values for Marketplace and dynamic ads: |
| The brand of a product item or hotel. |
| The category of the product item. |
| The city where a hotel, destination, automobile dealership, or home listing is located. |
| The city ID of the product item. |
| The value to use in a deep link URL ( |
| Type: string. The color of an item. |
| The condition of a product item or vehicle. Supported values for products: |
| The country where a hotel, home listing, automobile dealership, or destination is located. |
| The currency abbreviation for an item's, hotel's, home listing's, automobile dealership's, or destination's price. |
| The value of a custom label of a product item, hotel, destination, vehicle, or home listing. |
| The value of a custom label of a product item, hotel, or destination. |
| The value of a custom label of a product item, hotel, or destination. |
| The value of a custom label of a product item, hotel, or destination. |
| The value of a custom label of a product item, hotel, or destination. |
| The date a vehicle first arrived at the dealership. Used to indicate the inventory age. Should be in yyyy-mm-dd format. Example: |
| The date and time a vehicle first arrived at the dealership. |
| The number of days a home listing is on the open market. |
| The method with which an automobile dealer will be contacted by a buyer. Supported values: |
| The alphanumeric ID of an automobile dealership. |
| The name of the automobile dealership. |
| The vehicle's drivetrain. Supported values: |
| The description of a flight route, home listing, or destination. |
| The IATA code for the destination. Supports airport and city IATA code. Use IATA Code Search to validate IATA codes. To improve performance, avoid using a space for this unique ID. |
| The name of the destination city. Example: |
| The unique ID for a destination within a catalog. This ID will be matched with any |
| The exterior color of a vehicle |
| The ID of the product feed from which the item came. |
| The defined ID for a flight. |
| The type of fuel designated for a vehicle. Supported values: |
| The type of furnishing available for a home listing: |
| The gender of the product item. There are only 3 accepted values: |
| The granular nique ID for a home listing (apartment, condo, home). |
| The unique ID for a hotel within a catalog. This ID is matched with any |
| A string that describes an image. There can be multiple tags associated with an image. Example: [for home listings] When using a CSV/TSV file, we support two different formats: Use an image header that looks like: |
| The vehicle's interior color. |
| The type of home listing. Supported values for Marketplace: |
| The brand of a vehicle. Example |
| An indicator of the profitability of a hotel; value from |
| The market where an offer is eligible. Use for TWO FEED use case, to correspond with the market feed. For regional offers, this field is required and should match the |
| The material or fabric that a product is made out of. Example: 'Leather', 'Denim', 'Suede'. |
| The mileage unit of a vehicle in miles ( |
| For used vehicles, the current mileage of a vehicle in miles ( |
| The name of a vehicle product and sometimes a range of products. Example: |
| The name of a product item, hotel, home listing, or destination. |
| The neighborhood where a hotel or home listing is located. If there's more than one neighborhood, add additional columns for each one and use JSON-path syntax in each column name to indicate the number of neighborhoods. |
| The neighborhood ID of a product item. |
| The total number of bathrooms for a home listing. Must be |
| The total number of bedrooms for a home listing. Can be |
| The number of people who rated a hotel. |
| Number of starts the hotel has; for example, when you book a hotel and it has a rating that is 9 out of 10. |
| The total number of rooms for a home listing. |
| The total number of units in a building. Use only for apartments or condos, available as a rental. |
| The type of offer: |
| One-way price of a flight. You must specify the value with the currency. |
| The IATA code for the origin of an airport. Supports airport and city IATA codes. Use IATA Code Search to validate IATA codes. |
| The city name of the flight's origin. |
| The pattern or graphic print featured on a product. Example: 'Polka Dot', 'Striped', 'Paisley'. |
| The postal or zip code designated for a hotel location, home listing, or automobile dealership. Optional for countries without a postal code system. |
| For vehicle offer ads, the list of postal codes for the specific market provided in this format: |
| The price of a flight, home listing, vehicle, or destination. You must specify the value with currency. |
| The price multiplied by 100, for all currencies. Example: |
| The price change for a destination. Values include: |
| The priority of a flight or hotel. Values from |
| The expiration date when the product is no longer available. You can set an expiration date and if you have an ad running, it will fetch only the non-expired products. For example, if the expiration date is today, after today this product will no longer appear in ads. |
| The Facebook ID of the Product Feed of a product item, flight, hotel, home listing, vehicle, vehicle offer, or destination. |
| The Facebook ID of the Product Group of a product item. |
| The Facebook ID of a product item. |
| The retailer defined category of a product item. |
| The type of home listing property. Supported values for Marketplace: |
| The system the |
| The state, county, region, or province for a home listing or automobile dealership. |
| The region-defined ID of a product item or automobile dealership. |
| The retailer-defined ID of a product item, flight, hotel, home listing, vehicle, vehicle offer, or destination. |
| The retailer defined ID of a product group. |
| This is related to dynamic review. It tells if the product is accepted or rejected in review. Values can be |
| The sale price or special price of a vehicle. |
| For products: The sale price of a product item multiplied by 100, for all currencies. Example: |
| Value for the hotel rating score. Example: |
| The size of a product item. Example: 'XL', '16/34 Tall', '3.5 Kid' |
| The hotel star rating. Valid values: |
| The current state of a vehicle: |
| The full name of a vehicle. Max characters: 500. The title is relevant and specific to each vehicle and it should contain what is set in |
| The transmission type of the vehicle: |
| The trim of the vehicle: |
| The link to an external site where you can view a flight. If a deep link is specified on the ad level, that takes precedence. |
| The unique ID for a vehicle. Can be a variant for a vehicle. If there are multiple instances of the same ID, we ignore all instances. For vehicle offers, it is the ID that advertisers can use to identify an offer. This is also the same value that is passed under the |
| A metal or plastic plate attached to a motor vehicle or trailer for official identification purposes. For Marketplace, a vehicle registration plate is required in the United Kingdom, |
| The type of vehicle: |
| The vendor-defined ID of a product item. |
| The vehicle identification number. The VIN must be exactly 17 characters and is not required for pre-1983 vehicles. The VIN is required in all countries where Marketplace is available. In the United Kingdom, France, and Brazil, a vehicle registration plate is required instead of a VIN. |
| Toggle visibility on product item. Supported values: |
| The year a vehicle was launched in |
Starting March 3, 2022, we changed how certain filters work for product sets. These include the contains
, not_contains
, lt
, gt
, lte
, gte
, and starts_with
filters. You have 90 days to update your filters. If any sets in your catalog are using the affected filters after June 1, 2022, the items in those sets may change. This means that different items could display in your ads or shops that use those sets. See the changelog for more details.
Operator | Type of filter |
---|---|
| Returns products that match all query values inclusively. For example, |
| Returns products that match a query string. For example, |
| Returns products that match only one query value exclusively. For example, |
| Returns products that do not match a query string. For example, |
| Returns products that match any value in a list of query values. For example, |
| Returns products that do not match any value in a list of query strings. For example, |
| Returns products that exactly match a query value. For example, |
| Returns products that do not exactly match a query value. For example, |
| Returns products that are less than a numeric query value. For example, |
| Returns products that are less than or equal to a numeric query value. For example, |
| Returns products that are greater than a numeric query value. For example, |
| Returns products that are greater than or equal to a numeric query value. For example, |
| Returns products that match any string that starts with the query string. For example, |
To create a product set that matches specific product IDs, send a POST
request to the /PRODUCT-CATALOG-ID/product_sets
endpoint and set the retailer_id
filter field to is_any
operator and an array of product IDs.
curl -i -X POST
"https://graph.facebook.com/API-VERSION/PRODUCT-CATALOG-ID/product_sets
?name=Sample Product Set
&filter={
'retailer_id': {
'is_any': ['pid1', 'pid2']
}
}
&access_token=ACCESS-TOKEN"
To create a product set that matches all shirt items, send a POST
request to the /PRODUCT-CATALOG-ID/product_sets
endpoint and set the product_type
filter field to i_contains
operator and the string shirt
.
curl -i - X POST
"https://graph.facebook.com/API-VERSION/PRODUCT-CATALOG-ID/product_sets
&name=New Product Set Name
&filter={
'product_type': {
'i_contains': 'shirt'
}
}
&access_token=ACCESS-TOKEN"
Each rule is a JSON-encoded string.
Recommendation: Query with content type application/json
.
Rule | Description |
---|---|
| Match all products within the "Luggage & Bags" category. |
| Match all products with the retailer ID of pid1 or pid2. |
| Match all products with the |