Search code examples
ebay-api

eBay API CompleteSaleRequest failed with ErrorCode 21843


i want to update TrackingInformation within the CompleteSaleRequest but it returns "Invalid job context type"

what's wrong? anyone got a hint?

Request:

    <?xml version="1.0" encoding="UTF-8"?>
<CompleteSaleRequest xmlns="urn:ebay:apis:eBLBaseComponents">
   <RequesterCredentials>
      <eBayAuthToken>ABC...123</eBayAuthToken>
   </RequesterCredentials>
   <Shipped>true</Shipped>
   <ItemID>1234567890</ItemID>
   <TransactionID>99999999999</TransactionID>
   <OrderID>1234567890-99999999999</OrderID>
   <Shipment>
      <ShipmentTrackingDetails>
         <ShipmentTrackingNumber>12345678987654321</ShipmentTrackingNumber>
         <ShippingCarrierUsed>DHL</ShippingCarrierUsed>
      </ShipmentTrackingDetails>
   </Shipment>
</CompleteSaleRequest>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<GetOrdersResponse xmlns="urn:ebay:apis:eBLBaseComponents">
   <Timestamp>2016-03-08T20:58:58.831Z</Timestamp>
   <Ack>Failure</Ack>
   <Errors>
      <ShortMessage>Invalid job context type</ShortMessage>
      <LongMessage>The job context object is not supported by Action Service Framework.</LongMessage>
      <ErrorCode>21843</ErrorCode>
      <SeverityCode>Error</SeverityCode>
      <ErrorParameters ParamID="0">
         <Value>GetOrders</Value>
      </ErrorParameters>
      <ErrorParameters ParamID="1">
         <Value>CompleteSaleRequestType</Value>
      </ErrorParameters>
      <ErrorClassification>RequestError</ErrorClassification>
   </Errors>
   <Version>953</Version>
   <Build>E953_INTL_APIXO_17829668_R1</Build>
</GetOrdersResponse>

Solution

  • If you look at the response from eBay you will see that it is wrapped in GetOrdersResponse element. Since you are calling the CompleteSale operation you would expect it to be in a CompleteSaleResponse element. The reason will be due to how eBay routes the API requests. Since all operations go to the same URL the server needs a way to determine which operation you are calling. This is done by looking at the HTTP headers of the request. The contents of the body are ignored during this routing. The value of the HTTP header X-EBAY-API-CALL-NAME should contain the name of the operation that you are calling. I expect that at the moment it is GetOrders. If you set the header to CompleteSale the operation will be routed corrected and you should get the correct response.