You can use this API to create collections used in Shops and add metadata to a product set, such as a cover image and description. Such product sets are then ready to be used as collections in Commerce Manager to customize your Facebook or Instagram Shop (otherwise, Collections are manually created). You can also directly publish such ready product sets by providing the shop IDs. Shop IDs can be obtained from using Commerce APIs.
Learn more how to Create a Collection in Commerce Manager, Business Help Center.
Creating and updating product sets remains the same. However, there are a few new optional fields to note:
Field | Description |
---|---|
| Optional. Parent parameter for metadata block for collections. |
| Optional. Parameter to provide shop_id(s) to directly create/update product set and publish to shops. |
Field | Description |
---|---|
| Optional. URL of the cover image for the collection. |
| Optional. Customer-facing description for the product set. |
| Optional. URL of the collection. This URL is not shown to consumers, but serves as a default when creating ads that promote your product set. |
The field publish_to_shops
accepts an empty array or array with the parameters shown in the example below. If and empty array is provided, the given product set will be unpublished from all shops (if published earlier).
Field | Description |
---|---|
| shop_id is expected here and can be obtained using Commerce APIs. |
Example — Payload
{ "name": "Best sellers", "filter": { "retailer_id": { "is_any": [ "pid1", "pid2" ] } }, "metadata": { "cover_image_url": "https://foo.com/image.jpg" (https://foo.com/image.jpg%E2%80%9D), "external_url": "https://foo.com/best-sellers", "description":"Our best selling products" } "publish_to_shops": [{"shop_id": "shop_id1"}, {"shop_id": "shop_id2"}] }
Create a product set with Collection metadata that matches specific product IDs:
curl \ -F "name=Best Sellers" \ -F "filter={'retailer_id': {'is_any': ['pid1', 'pid2']}}" -F "metadata={'cover_image_url':'https://foo.com/image.jpg', 'external_url':'https://foo.com/best-sellers', 'description':'Our best selling products'}" \ -F "access_token=<ACCESS_TOKEN>" \ https://graph.facebook.com/API_VERSION/PRODUCT_CATALOG_ID/product_sets
Update an existing product set with Collection metadata and publish to shops:
curl \ -F "name=Updated Best Sellers" \ -F "metadata={'cover_image_url':'https://foo.com/image_updated.jpg', 'external_url':'https://foo.com/best-sellers-updated', 'description':'Our updated best selling products'}" \ -F "publish_to_shops=[{'shop_id':'shop_id1'}, {'shop_id':'shop_id2'}]" -F "access_token=<ACCESS_TOKEN>" \ https://graph.facebook.com/API_VERSION/PRODUCT_SET_ID
On the GET
node, the live_metadata
field returns metadata that is published and live on a particular product set, while the latest_metadata
field returns the metadata that was last sent to the API. These fields may differ if, for example, an image was changed upon update and was rejected for integrity reasons.
All fields are non-default fields and should be explicitly called in the Graph API as field parameters.
Field | Description |
---|---|
| Latest metadata information that was sent. May not be the same as |
| Current, live metadata for this product set. |
Field | Description |
---|---|
| URL of the customer-facing cover image for the product set. |
| Customer-facing description for the product set. |
| URL of the collection. This URL is not shown to consumers, but serves as a default when creating ads that promote your product set. |
| Integrity review status. Can be one of |
Example — Read a product set to see what metadata is live:
curl -G \ -d "access_token=<ACCESS_TOKEN>" \ https://graph.facebook.com/<API_VERSION>/<PRODUCT_SET_ID>/?fields=id,name,latest_metadata{cover_image_url, description, review_status},live_metadata{cover_image_url, description, review_status}
Response:
{ "id": 1234567890, "name": "Best sellers", "latest_metadata": { "cover_image_url": "https://foo.com/some_new_image.jpg" (https://foo.com/image.jpg%E2%80%9D), "description":"Our best selling products", "integrity_review_status": "REJECTED" }, "live_metadata": { "cover_image_url": "https://foo.com/some_good_image.jpg", "description":"Our best selling products", "integrity_review_status": "APPROVED" } }
A: Images must be at least 600x600 (although edit cropping is unavailable at this ratio). If uploading 800x800 or larger, a square aspect ratio is selected as default. For best results, we recommend an aspect ratio of 1080x1080.
A: The maximum file size is 8 MB.
A: JPG and PNG are supported.
A: There is no minimum length for description. The maximum length is 200 characters.
A: You can use Update API and remove the shop_id
field from publish_to_shop
list where it was previously published. If empty array ([]) is provided, product set would be unpublished from all the shops.