Search code examples
xmlebay-api

eBay API request not returning item weight


I am trying to get the weight of an item I am selling on eBay using their API and it doesnt seem to be returning what they say it should be.

Currently my request XML looks like this:

<?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>

This should give me this output according to the 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>

I have highlighted with ** text ** what I want to see. But when I print out my responseXML in xcode (Swift) I get this:

<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>

Has anyone ever had this problem before? And know of a work around? The eBay API and support forums are not too helpful.


Solution

  • You can retrieve the item weight using the TradingAPI's GetItem call. Just remember to set

    <GranularityLevel>Fine</GranularityLevel>
    

    in the request XML.

    Or you can retrieve all the items' weight using a single GetSellerList call and again remember to set GranularityLevel to Fine.