- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我已经阅读了很多关于 Amazon API 的文档,但仍然不清楚我收到的错误,文档没有提供有用的示例。
我正在使用它来更新我的库存:
我阅读了不同的文档,每个文档都说明了一个新的服务 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 时:
config.ServiceURL = "https://mws.amazonservices.co.uk/FulfillmentInventory/2011-10-01";
我收到以下错误响应:
<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";
我收到以下错误响应:
<BusinessLogicError>CUSTOMER_UNAUTHORIZED</BusinessLogicError>
请让我知道这段代码是否有问题,因为我完全按照文档进行操作,这已经是我花在这上面的第 3 天了。也许我疯了:D
这些都是小问题,我想不通。
最佳答案
您的代码有一些问题。我假设您想更新您自己完成的库存(而不是 FBA )。我还假设您是亚马逊要求使用任何 MWS API 的 Pro Merchant。
英国的正确 serviceUrl
是 https://mws.amazonservices.co.uk
。更新/添加库存的正确 feedType
是 _POST_FLAT_FILE_LISTINGS_DATA_
。您还可以使用其他提要类型。请参阅 Feeds API reference 的 Feed Type Enumeration 部分。这种类型的提要是制表符分隔的文件,您可以找到模板 here 。还有一种 XML 类型的提要,但您必须拥有适当的帐户才能使用这种类型的提要提交。这些类型的帐户仅限受邀者。
假设您已经下载了 C# Feeds API,您应该查看解决方案内的 MarketplaceWebService.Samples 项目中包含的 MarketplaceWebServiceSamples.cs 文件。该文件有一堆已被注释掉的部分。找到处理 Submit Feed 操作的那个,并用它来学习如何提交 Feed。
您应该花更多时间阅读 Feeds API documentation,尤其是 Feed Type Enumeration 部分,因为您可以使用其他类型的 feed(仅限制表符分隔)。
关于c# - 使用 API 在亚马逊上更新商品数量时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8752759/
我已经设置了 Azure API 管理服务,并在自定义域上配置了它。在 Azure 门户中 API 管理服务的配置部分下,我设置了以下内容: 因为这是一个客户端系统,我必须屏蔽细节,但以下是基础知识:
我是一名习惯 React Native 的新程序员。我最近开始学习 Fetch API 及其工作原理。我的问题是,我找不到人们使用 API key 在他们的获取语句中访问信息的示例(我很难清楚地表达有
这里有很多关于 API 是什么的东西,但是我找不到我需要的关于插件 API 和类库 API 之间的区别。反正我不明白。 在 Documenting APIs 一书中,我读到:插件 API 和类库 AP
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve thi
我正在尝试找出设计以下场景的最佳方法。 假设我已经有了一个 REST API 实现,它将从不同的供应商那里获取书籍并将它们返回给我自己的客户端。 每个供应商都提供单独的 API 来向其消费者提供图书。
请有人向我解释如何使用 api key 以及它有什么用处。 我对此进行了很多搜索,但得到了不同且相互矛盾的答案。有人说 API key 是保密的,它从不作为通信的一部分发送,而其他人则将它发送给客户端
关闭。这个问题是opinion-based .它目前不接受答案。 想改进这个问题?更新问题,以便 editing this post 可以用事实和引用来回答它. 4年前关闭。 Improve this
谁能告诉我为什么 WSo2 API 管理器不进行身份验证?我已经设置了两个 WSo2 API Manager 1.8.0 实例并创建了一个 api。它作为原型(prototype) api 工作正常。
我在学习 DSL 的过程中遇到了 Fluent API。 我在流利的 API 上搜索了很多……我可以得出的基本结论是,流利的 API 使用方法链来使代码流利。 但我无法理解——在面向对象的语言中,我们
基本上,我感兴趣的是在多个区域设置 WSO2 API 管理器;例如亚洲、美国和欧洲。一些 API 将部署在每个区域的数据中心内,而其他 API 将仅部署在特定区域内。 理想情况下,我想要的是一个单一的
我正在构建自己的 API,供以下用户使用: 1) 安卓应用 2) 桌面应用 我的网址之一是:http://api.chatapp.info/order_api/files/getbeers.php我的
我需要向所有用户显示我的站点的分析,但使用 OAuth 它显示为登录用户配置的站点的分析。如何使用嵌入 API 实现仪表板但仅显示我的网站分析? 我能想到的最好的可能性是使用 API key 而不是客
我正在研究大公司如何管理其公共(public) API。我想到的是拥有成熟 API 的公司,例如 Google、Facebook、Twitter 和 Amazon。 这些公司向公众公开了许多不同的 A
在定义客户可访问的 API 时,以下是首选的行业惯例: a) 定义一组显式 API 方法,每个方法都有非常狭窄和特定的目的,例如: SetUserName SetUserAge Se
这在本地 deserver 和部署时都会发生。我成功地能够通过留言簿教程使用 API 资源管理器,但现在我已经创建了自己的项目并尝试访问我编写的第一个 API,它从未出现过。搜索栏旁边的黄色“正在加载
我正在尝试使用 http://ip-api.com/ api通过我的ip地址获取经度和纬度。当我访问 http://ip-api.com/json从我的浏览器或使用 curl,它以 json 格式返回
这里的典型示例是 Twitter 的 API。我从概念上理解 REST API 的工作原理,本质上它只是针对您的特定请求向他们的服务器查询,然后您会在其中收到响应(JSON、XML 等),很棒。 但是
我能想到的最好的标题,但要澄清的是,情况是这样的: 我正在开发一种类似短 url 的服务,该服务允许用户使用他们的 Twitter 帐户“登录”并发布内容。现在这项服务可以包含在 Tweetdeck
我正在设计用于管理评论和讨论线程的 API 方案。我想有一个点 /discussions/:discussionId 当您GET 时,它会返回一组评论和一些元数据。评论也许可以单独访问 /discus
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭去年。 Improve this quest
我是一名优秀的程序员,十分优秀!