eBay API没有给予重量

时间:2016-06-28 21:02:00

标签: xml api ebay

我正在尝试使用他们的API来获取我在eBay上销售的商品的重量,并且它似乎没有返回他们应该说的内容。

目前我的请求XML如下所示:

<?xml version="1.0" encoding="utf-8"?>
    <GetItemShippingRequest xmlns="urn:ebay:apis:eBLBaseComponents">
        <RequesterCredentials>
            <eBayAuthToken>{{Auth Token}}</eBayAuthToken>
        </RequesterCredentials>
        <Version>947</Version>
        <ItemID>{{ Item ID}}</ItemID>
        <QuantitySold>1</QuantitySold>
        <DestinationPostalCode>{{Destination PostCode}}</DestinationPostalCode>
        <DestinationCountryCode>{{Destination Country}} </DestinationCountryCode>
    </GetItemShippingRequest>

根据eBay API,这应该给我这个输出:

<ShippingDetails>
    <CalculatedShippingRate>
    <OriginatingPostalCode>95125</OriginatingPostalCode>
        <PackagingHandlingCosts currencyID="USD">3.0</PackagingHandlingCosts>
        <ShippingIrregular>true</ShippingIrregular>
        <ShippingPackage>LargeEnvelope</ShippingPackage>
        **<WeightMajor unit="lbs" measurementSystem="English">0</WeightMajor>
        <WeightMinor unit="oz" measurementSystem="English">2</WeightMinor>**
    </CalculatedShippingRate>
    <ShippingRateErrorMessage>No Error</ShippingRateErrorMessage>
    <ShippingRateType>OnDemand</ShippingRateType>
    <ShippingServiceOptions>
        <ShippingService>UPS2ndDay</ShippingService>
        <ShippingServiceCost currencyID="USD">26.52</ShippingServiceCost>
        <ShippingServicePriority>1</ShippingServicePriority>
        <ExpeditedService>false</ExpeditedService>
        <ShippingTimeMin>1</ShippingTimeMin>
        <ShippingTimeMax>2</ShippingTimeMax>
    </ShippingServiceOptions>
    <ShippingType>Calculated</ShippingType>
</ShippingDetails>

我用**文本**突出显示了我想看到的内容。但是当我在xcode(Swift)中打印出我的responseXML时,我得到了这个:

<GetItemShippingResponse xmlns="urn:ebay:apis:eBLBaseComponents">
    <Timestamp>2016-06-28T16:54:59.923Z</Timestamp>
    <Ack>Success</Ack>
    <Version>967</Version>
    <Build>E967_CORE_APISHIP_17966524_R1</Build>
    <ShippingDetails>
        <ShippingRateErrorMessage>No Error</ShippingRateErrorMessage>
        <InternationalShippingServiceOption>
        <ShippingService>InternationalPriorityShippingUK</ShippingService>
            <ShippingServiceCost currencyID="GBP">10.42</ShippingServiceCost>
            <ShippingServicePriority>1</ShippingServicePriority>
            <ShipToLocation>AU</ShipToLocation>
            <ShipToLocation>US</ShipToLocation>
            <ShipToLocation>CA</ShipToLocation>
            <ShipToLocation>JP</ShipToLocation>
            <ShipToLocation>NZ</ShipToLocation>
            <ShipToLocation>CN</ShipToLocation>
            <ShipToLocation>IL</ShipToLocation>
            <ShipToLocation>HK</ShipToLocation>
            <ShipToLocation>ID</ShipToLocation>
            <ShipToLocation>MY</ShipToLocation>
            <ShipToLocation>MX</ShipToLocation>
            <ShipToLocation>SG</ShipToLocation>
            <ShipToLocation>KR</ShipToLocation>
            <ShipToLocation>TW</ShipToLocation>
            <ShipToLocation>TH</ShipToLocation>
            <ShipToLocation>TR</ShipToLocation>
            <ImportCharge currencyID="GBP">0.0</ImportCharge>
        </InternationalShippingServiceOption>
        <ShippingType>Flat</ShippingType>
    </ShippingDetails>
</GetItemShippingResponse>

以前有没有人遇到这个问题?知道一项工作吗? eBay API和支持论坛不太有用。

1 个答案:

答案 0 :(得分:1)

您可以使用TradingAPI的GetItem电话检索项目权重。只记得设置

<GranularityLevel>Fine</GranularityLevel>
请求XML中的

或者您可以使用一次GetSellerList电话检索所有项目的权重,并再次记住将GranularityLevel设置为Fine