日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

AMAZON SP API Feed

發布時間:2023/12/20 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 AMAZON SP API Feed 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

參考資料
feedType : https://github.com/amzn/selling-partner-api-docs/blob/main/references/feeds-api/feedtype-values.md
使用方法:https://developer-docs.amazon.com/sp-api/docs/feeds-api-v2021-06-30-reference

例:修改Price

1. 先創建 feedDocument

$params = array('contentType' => 'text/xml; charset=UTF-8', ); $method = 'POST'; $path = '/feeds/2021-06-30/documents';

// 請求成功時,會返回:
$feedDocumentId;
$url;

2.上傳 xml 文件內容

// XML

$xml = '<?xml version="1.0" encoding="UTF-8"?>'; $xml .= '<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">'; $xml .= '<Header>'; $xml .= '<DocumentVersion>1.01</DocumentVersion>'; $xml .= '<MerchantIdentifier>' . $merchant_id . '</MerchantIdentifier>'; $xml .= '</Header>'; $xml .= '<MessageType>Price</MessageType>'; $xml .= '<Message>'; $xml .= '<MessageID>1</MessageID>'; $xml .= '<Price>'; // SELLER SKU $xml .= '<SKU>' . $amazon_seller_sku . '</SKU>'; // 售價 $xml .= '<StandardPrice currency="' . $currencyCode . '">1</StandardPrice>'; // 折扣價 $xml .= '<Sale>'; $xml .= '<StartDate>' . '2020-02-02T00:00:00Z' . '</StartDate>'; $xml .= '<EndDate>' . '2020-02-02T00:00:00Z' . '</EndDate>'; $xml .= '<SalePrice currency="' . $currencyCode . '">1</SalePrice>'; $xml .= '</Sale>'; $xml .= '</Price>'; $xml .= '</Message>'; // 同時修改多個時 $xml .= '<Message>'; $xml .= '<MessageID>2</MessageID>'; $xml .= '<Price>'; // SELLER SKU $xml .= '<SKU>' . $listing['amazon_seller_sku'] . '</SKU>'; // 售價 $xml .= '<StandardPrice currency="' . $currencyCode . '">1</StandardPrice>'; // 折扣價 $xml .= '<Sale>'; $xml .= '<StartDate>' . '2020-02-02T00:00:00Z' . '</StartDate>'; $xml .= '<EndDate>' . '2020-02-02T00:00:00Z' . '</EndDate>'; $xml .= '<SalePrice currency="' . $currencyCode . '">1</SalePrice>'; $xml .= '</Sale>'; $xml .= '</Price>'; $xml .= '</Message>'; $xml .= '</AmazonEnvelope>';$config = array('base_uri' => $url,'headers' => array('Content-Type' => 'text/xml; charset=UTF-8'),'body' => $xml,'http_errors' => false,'verify' => false,'timeout' => 1800 ); $client = new GuzzleHttp\Client($config); $request = $client->request("PUT"); $body = $request->getBody()->getContents(); $httpCode = $request->getStatusCode();'ack' => ($httpCode == 200) ? SUCCESS : FAILURE,

3.創建Feed

$params = array('feedType' => 'POST_PRODUCT_PRICING_DATA','marketplaceIds' => array($marketplace_id), // 市場ID'inputFeedDocumentId' => $feedDocumentId ); $method = 'POST'; $path = '/feeds/2021-06-30/feeds';

總結

以上是生活随笔為你收集整理的AMAZON SP API Feed的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。