2012-01-06 9 views
4

Amazon APIに関する多くのドキュメントを読んでいますが、私が受け取っているエラーではまだ分かりません。APIを使用してAmazonのアイテム数を更新する際にエラーが発生しました

私は私のinventoyを更新するために、これを使用しています:

私は別の文書、新しいサービスのURLを記載し、それぞれを読んでいる、と私はそれについて本当に混乱しています。..

config.ServiceURL = "https://mws.amazonservices.co.uk/FulfillmentInventory/2011-10-01"; 
config.ServiceURL = "https://secure.amazon.co.uk/exec/panama/seller-admin/catalog-upload/modify-only"; 

私のコードを開始しますプロセスと要求を送信は、次のとおりです。

String accessKeyId = "#"; 
String secretAccessKey = "#"; 
String merchantId = "#"; 
String marketplaceId = "#"; 

MemoryStream stream = new MemoryStream(); 
stream = GenerateInventoryDocument(txtxSku.Text, merchantId, txtQuantity.Text); 

const string applicationName = "C#"; 
const string applicationVersion = "4"; 

MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig(); 

MarketplaceWebService.MarketplaceWebService service = new MarketplaceWebServiceClient(accessKeyId, secretAccessKey, applicationName, applicationVersion, config); 
MarketplaceWebService.Model.SubmitFeedResponse response = new MarketplaceWebService.Model.SubmitFeedResponse(); 

MarketplaceWebService.Model.SubmitFeedRequest request = new MarketplaceWebService.Model.SubmitFeedRequest(); 
request.Merchant = merchantId; 
request.MarketplaceIdList = new MarketplaceWebService.Model.IdList(); 
request.MarketplaceIdList.Id = new List<string>(new string[] { marketplaceId }); 

request.FeedContent = stream; 
request.ContentMD5 = MarketplaceWebServiceClient.CalculateContentMD5(request.FeedContent); 
request.FeedContent.Position = 0; 

request.FeedType = "_POST_INVENTORY_AVAILABILITY_DATA_"; 

SubmitFeedSample.InvokeSubmitFeed(service, request); 

GenerateInventoryDocument()機能は次のとおりです。

MemoryStream myDocument = new MemoryStream(); 
string myString; 

//Add the document header. 
myString = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>"; 
this.AddStringToStream(ref myString, myDocument); 

myString = "<AmazonEnvelope xsi:noNamespaceSchemaLocation=\"amzn-envelope.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"; 
this.AddStringToStream(ref myString, myDocument); 

myString = "<Header>"; 
this.AddStringToStream(ref myString, myDocument); 

myString = "<DocumentVersion>1.01</DocumentVersion>"; 
this.AddStringToStream(ref myString, myDocument); 

myString = "<MerchantIdentifier>" + merchantID + "</MerchantIdentifier>"; 
this.AddStringToStream(ref myString, myDocument); 

myString = "</Header>"; 
this.AddStringToStream(ref myString, myDocument); 

myString = "<MessageType>Inventory</MessageType>"; 
this.AddStringToStream(ref myString, myDocument); 

myString = "<Message>"; 
this.AddStringToStream(ref myString, myDocument); 

myString = "<MessageID>1</MessageID>"; 
this.AddStringToStream(ref myString, myDocument); 

myString = "<OperationType>Update</OperationType>"; 
this.AddStringToStream(ref myString, myDocument); 

myString = "<Inventory>"; 
this.AddStringToStream(ref myString, myDocument); 

myString = "<SKU>" + sku + "</SKU>"; 
this.AddStringToStream(ref myString, myDocument); 

myString = "<FulfillmentLatency>1</FulfillmentLatency>"; 
this.AddStringToStream(ref myString, myDocument); 

myString = "<Quantity>" + quantity + "</Quantity>"; 
this.AddStringToStream(ref myString, myDocument); 

myString = "</Inventory>"; 
this.AddStringToStream(ref myString, myDocument); 

myString = "</Message>"; 
this.AddStringToStream(ref myString, myDocument); 

myString = "</AmazonEnvelope>"; 
this.AddStringToStream(ref myString, myDocument); 

return myDocument; 

私はこのURLを使用する場合:

<ErrorResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2011-10-01/"> 
    <Error> 
     <Type>Sender</Type> 
     <Code>NoSuchVersion</Code> 
     <Message>The requested version (2010-01-01) is not valid.</Message> 
     <Detail/> 
    </Error> 
    <RequestID>f35d1eb0-b8e7-40c0-8394-027619fb0762</RequestID> 
</ErrorResponse> 

そして私は、私は別のドキュメントに読み込むこのサービスURLを使用します:

config.ServiceURL = "https://secure.amazon.co.uk/exec/panama/seller-admin/catalog-upload/modify-only"; 

config.ServiceURL = "https://mws.amazonservices.co.uk/FulfillmentInventory/2011-10-01"; 

を私は次のようなエラー応答を取得

次のエラー応答が表示されます。

このコードに間違いがある場合は、私が文書を完全に守っているので、私にこれを費やしたのは3日目です。多分私は自分の心を失っています:D

これらは小さな問題であり、私はそれらを理解することはできません。

+1

あなたのFBAインベントリを操作しようとしていますか?あなたは、あなたの通常の在庫と連携するように設計されたフィードAPIを使用しています。 FBAインベントリを使用しようとする場合、FBAインバウンドAPI https://developer.amazonservicesが必要です。com/gp/mws/api.html?ie = UTF8&section = inbound&group = fba&version = latest通常のインベントリで作業する場合は、適切なURLと使用方法を示すMarketplaceWebServiceSamples.csを見てください。 –

+0

こんにちは、返信ありがとう:) .. 私はFBAと通常の在庫の違いを理解していないことを説明できますか? – confusedMind

+0

Amazon(FBA)はAmazonに発送する在庫品であり、Amazonが販売している場合は顧客に出荷されます。フィードAPIを使用してAmazonに新しい在庫をリストする機能(通常の在庫)を使用したいと思うことが多分あります。 C#Feeds APIに付属のMarketplaceWebServiceSamples.csをご覧になり、インベントリの送信/編集方法の学習に役立ちます。 –

答えて

4

コードにはいくつか問題があります。私はあなたが達成している在庫を更新したいと思っています(FBAとは対照的に)。また、AmazonがMWS APIを使用するために必要なPro Merchantであると仮定しています。

英国の正しいserviceUrlhttps://mws.amazonservices.co.ukです。在庫を更新/追加するための正しいfeedType_POST_FLAT_FILE_LISTINGS_DATA_です。あなたが使用できる他のフィードタイプがあります。 Feeds API referenceのフィードタイプ列挙セクションを参照してください。このタイプのフィードはタブで区切られたファイルで、テンプレートはhereです。 XML形式のフィードもありますが、このタイプのフィード送信を使用するには適切なアカウントが必要です。これらのタイプのアカウントは、招待によるものです。

C# Feeds APIをダウンロードしたとすると、ソリューション内のMarketplaceWebService.Samplesプロジェクトに含まれているMarketplaceWebServiceSamples.csファイルを確認する必要があります。このファイルには、コメントアウトされたセクションがたくさんあります。フィードの送信アクションを扱うアクションを見つけ、それを使用してフィードを送信する方法を学習します。

Feeds API documentation特に、フィードタイプ列挙セクションは、他の種類のフィードを使用できるようにする必要があります(タブ区切りのみ)。

+0

hmmm、ありがとう。 – confusedMind

関連する問題