데이터 피드 업로드 예약

이 가이드를 사용하여 피드를 업로드하고 예약하세요.

피드 업로드

피드를 업로드하려면 catalog_management 권한이 필요합니다. 마케팅 API, 권한을 참조하세요. 카탈로그를 만든 후에는 catalog id를 사용하여 제품 피드를 만들고 예약합니다.

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/v20.0/{product-catalog-id}/product_feeds
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const ProductCatalog = bizSdk.ProductCatalog; const ProductFeed = bizSdk.ProductFeed; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<PRODUCT_CATALOG_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'name' : 'Test Feed', 'schedule' : {'interval':'DAILY','url':'http://www.example.com/sample_feed.tsv','hour':'22'}, }; const product_feeds = (new ProductCatalog(id)).createProductFeed( fields, params ); logApiCallResult('product_feeds api call complete.', product_feeds);
require __DIR__ . '/vendor/autoload.php'; use FacebookAds\Object\ProductCatalog; use FacebookAds\Object\ProductFeed; use FacebookAds\Api; use FacebookAds\Logger\CurlLogger; $access_token = '<ACCESS_TOKEN>'; $app_secret = '<APP_SECRET>'; $app_id = '<APP_ID>'; $id = '<PRODUCT_CATALOG_ID>'; $api = Api::init($app_id, $app_secret, $access_token); $api->setLogger(new CurlLogger()); $fields = array( ); $params = array( 'name' => 'Test Feed', 'schedule' => array('interval' => 'DAILY','url' => 'http://www.example.com/sample_feed.tsv','hour' => '22'), ); echo json_encode((new ProductCatalog($id))->createProductFeed( $fields, $params )->exportAllData(), JSON_PRETTY_PRINT);
from facebook_business.adobjects.productcatalog import ProductCatalog from facebook_business.adobjects.productfeed import ProductFeed from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<PRODUCT_CATALOG_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'name': 'Test Feed', 'schedule': {'interval':'DAILY','url':'http://www.example.com/sample_feed.tsv','hour':'22'}, } print ProductCatalog(id).create_product_feed( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<PRODUCT_CATALOG_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new ProductCatalog(id, context).createProductFeed() .setName(\"Test Feed\") .setSchedule(\"{\\"interval\\":\\"DAILY\\",\\"url\\":\\"http://www.example.com/sample_feed.tsv\\",\\"hour\\":\\"22\\"}\") .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<PRODUCT_CATALOG_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end product_catalog = FacebookAds::ProductCatalog.get(id) product_feeds = product_catalog.product_feeds.create({ name: 'Test Feed', schedule: {'interval':'DAILY','url':'http://www.example.com/sample_feed.tsv','hour':'22'}, })

schedule 매개변수를 사용하면 피드 업로드를 예약할 수 있습니다. 옵션에는 interval, url, hour가 포함됩니다. 또한 day_of_week, minute, usernamepassword도 포함될 수 있습니다.

참고: usernamepassword의 경우 HTTP와 FTP에서 기본 인증을 지원합니다.

— 피드 업로드 예약

schedule: {"day_of_week":"FRIDAY","hour":17,"interval_count":1,"interval":"DAILY","minute":42,"next_scheduled_upload_time":"","password":pwd123,"status":"active","timezone":"Atlantic/Canary","url":"https://www.abc.com","username":aname}

개별 품목 업데이트

개별 품목의 데이터를 실시간으로 업데이트합니다. 업데이트된 필드를 HTTP POST에 포함합니다. 여기에서 retailer_id는 피드의 품목 ID입니다. 이는 base64url로 인코딩되어야 합니다.

https://graph.facebook.com/catalog:{CATALOG_ID}:{base64urlencode(retailer_id)}

가변 필드는 제품, 참고 자료를 참조하세요.

API를 사용하여 품목 피드에 개별 품목 업데이트, 생성 또는 삭제를 제공하지 마세요. Facebook에서는 피드로 이를 추적하지 않으므로 API로 생성한 품목의 업데이트나 삭제가 중단될 수 있습니다.

데이터 피드 가져오기 예약

예약된 피드는 1시간에 1회 이상의 업로드를 지원하지 않습니다. 인벤토리를 더 빠르게 업데이트해야 하는 경우 직접 업로드 API를 사용하는 것이 좋습니다.

Facebook의 API를 사용하여 피드를 만들고 관리하는 경우, 생성하고자 하는 업데이트 일정에 대한 상세 정보를 포함하여 API 요청을 Facebook에 보내야 합니다.

curl \
  -F 'name=Test Feed' \
  -F 'update_schedule={ 
    "interval": "HOURLY", 
    "url": "http:\/\/www.example.com\/sample_feed_updates.tsv",
    "hour": 22
  }' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/<API_VERSION>/<CATALOG_ID>/product_feeds

Facebook은 정의된 일정에 따라 시스템에서 품목 피드를 가져옵니다. 정의 가능한 일정에는 다음 두 가지 유형이 있습니다.

  • update_schedule — 업로드 시 새로운 품목을 만들거나 데이터 피드 파일에 제공된 정보로 기존 품목을 업데이트합니다.
  • schedule — 업로드 시 데이터 피드에서 완전한 새로 고침 작업이 수행됩니다. Facebook에서 파일에 없는 품목을 삭제하고 기존 품목을 업데이트하며 새로운 품목을 생성합니다. 필요에 따라 두 가지 일정 중 하나를 사용하거나 둘 다 사용할 수 있습니다.

예를 들어 update_scheduleHOURLY 빈도로 설정하고 scheduleDAILY 빈도로 설정합니다.

피드를 보다 빠르게 처리하기 위해 update_schedule은 데이터 피드 파일에서 변경된 데이터로만 설정하는 것이 좋습니다. 이는 특히 연말연시 판매와 가격 및 재고를 더 신속하게 업데이트하려는 경우에 유용합니다. 또한 유사한 가용 품목으로 사용자를 리타게팅할 수 있도록 피드에서 품목을 삭제하기보다는 '품절'로 표시하는 것이 좋습니다.

curl \
  -F 'name=Test Feed' \
  -F 'schedule={ 
    "interval": "DAILY", 
    "url": "http:\/\/www.example.com\/sample_feed.tsv"
  }' \
  -F 'update_schedule={ 
    "interval": "HOURLY", 
    "url": "http:\/\/www.example.com\/sample_feed_updates.tsv",
    "hour": 22
  }' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/<API_VERSION>/<CATALOG_ID>/product_feeds

응답:

{ "id" : {FEED_ID} }

데이터 피드 참고 자료, 데이터 피드 예약 참고 자료를 참조하세요.