使用Facebook Graph API V20上传商品至商务目录遇link字段报错求助
解决Facebook Graph API V20商品上传缺少link字段报错问题
问题重现
上传商品至商务目录时,持续收到如下报错:
"error_user_msg": "Products without \"link\" information can't be uploaded. Please check that this field is included for each product in a separate, labelled column."
已确认字段格式合规,且API调用、直接Post请求均返回相同错误,测试请求数据如下:
var postData = { "retailer_id": "TEST_SKU_12345", // 测试用静态SKU "name": "Test Product", "price": 100, // 价格用整数 "currency": "USD", // 默认美元 "link": encodeURIComponent("https://store.casablancawirelessllc.com/g-power-5g?sku=PQPWFV"), // URL编码后的链接 "image_url": "https://b3213372.smushcdn.com/3213372/wp-content/uploads/2023/07/stacks-dark-1.png" // 有效图片链接 };
解决方案
1. 移除link字段的手动URL编码
Graph API会自动处理URL的编码工作,手动调用encodeURIComponent会导致链接被识别为非标准格式,系统无法判定为有效link字段。修改后的代码如下:
var postData = { "retailer_id": "TEST_SKU_12345", "name": "Test Product", "price": 100, "currency": "USD", "link": "https://store.casablancawirelessllc.com/g-power-5g?sku=PQPWFV", // 直接传递原始URL "image_url": "https://b3213372.smushcdn.com/3213372/wp-content/uploads/2023/07/stacks-dark-1.png" };
2. 确认请求Content-Type设置
确保请求的Content-Type头部为application/json,避免JSON数据被错误解析,导致link字段未被正确识别。
3. 验证link字段的有效性
确认链接为可正常访问的公开URL,且链接所在域名已完成商务平台的域名验证,避免被Facebook安全机制拦截。
内容的提问来源于stack exchange,提问作者NachoManRanchySalad
相关产品推荐
相关产品推荐

