使用Ebay API提供优惠

时间:2014-12-07 21:52:14

标签: api ebay-api

这是针对Ebay API的API调用的文档,但我似乎找不到如何构造URI的示例... http://developer.ebay.com/Devzone/XML/docs/Reference/ebay/PlaceOffer.html我也想知道是否有人发现了股票经纪人API或其他在线业务。

这是ebay为搜索产品提供的示例URI,但是关于如何使用此基本布局构建其他URI的文档并不是很直接

var url = "http://svcs.ebay.com/services/search/FindingService/v1"+
   "?OPERATION-NAME=findItemsByKeywords"+
   "&SERVICE-VERSION=1.0.0"+
   "&SECURITY-APPNAME=myKey"+
   "&GLOBAL-ID=EBAY-US"+
   "&RESPONSE-DATA-FORMAT=XML"+
   "&REST-PAYLOAD"+
   "&keywords=harry%20potter%20phoenix"+
   "&paginationInput.entriesPerPage=15";

如果您确实知道某事,可以链接我或者分享URI吗?

1 个答案:

答案 0 :(得分:0)

好像你正在混淆eBay API ...你发布的示例是用于Finding API这个API可以被那些简单的URL调用,几乎所有其他API都是基于SOAP的,并且需要一些特殊的HEADER和XML帖子体...

PlaceOffer Call属于Trading API ...我已在另一个主题中准备了一个示例:

php api ebay integration

编辑评论:

你需要POST一个基于XML的请求,看起来像这样:

<soap:Envelope encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" mlns="urn:ebay:apis:eBLBaseComponents" xmlns:soap="http://schemas.xmlsoap.org soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soap:Header>
       <RequesterCredentials>****</RequesterCredentials>
   </soap:Header>
   <soap:Body>
       <PlaceOfferRequest>
           <Version>899</Version>
           <Offer>
            <Action>Bid</Action>
               <ItemID>YOUR ITEM ID</ItemID>
               <MaxBid>YOUR MAX BID AMOUNT</MaxBid>
           </Offer>
       </PlaceOfferRequest>
   </soap:Body>

响应(因为我使用了无效的最高出价/项目ID而出错)

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
 <soapenv:Fault>
  <faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Server</faultcode>
  <faultstring>Input data is invalid.</faultstring>
  <faultactor>http://www.ebay.com/ws/websvc/eBayAPI</faultactor>
  <detail>
   <FaultDetail>
    <ErrorCode>37</ErrorCode>
    <Severity>Error</Severity>
    <DetailedMessage>Input data for tag &lt;Offer.MaxBid&gt; is invalid or missing. Please check API documentation.</DetailedMessage>
   </FaultDetail>
  </detail>
  </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>