One Example of eBay’s Trading API Java SDK Consistent Inconsistencies
I’m in the middle of a project for my graduate degree which involves creating a helper app for eBay sellers to list their items on eBay through its Trading API. I’m writing it in Java so I’m using their Java SDK. The version I’m currently using is version 687, their latest one. I’ve been bitching and moaning about a lot of things in their API & Java SDK documentation, but the one thing that finally pushed me over the edge and made me write this angry rant is eBay’s inconsistency in observing its own business rules inside the SDK.
Take the class of
ShippingServiceDetailsType as an example. It has the method
isValidForSellingFlow() which tells us that “If
true, the shipping service can be used in the AddItem family of calls. If
false, the shipping service is not currently supported when creating or modifying listings.” The problem is that it seems that the programmers forgot that a boolean value is a binary condition and added a third option of
null. Just beautiful. When I retrieve US eBay Site’s possible values for the
ShippingServiceDetailsType class through
getShippingServiceDetails() method, all I’m getting for the 68 returned objects’
isValidForSellingFlow() method is either
At this point, one would assume that the
nulls should just be treated as
falses, right? Wrong! By doing just that, I created lists of ShippingServiceDetailsType for domestic and international shipping without the ones with null values, effectively excluding three possible ShippingServiceDetailsType for freight shipping (they’re the only ones available for freight shipping, mind you). The lists would then be fed into my add item JSP, rendering my user unable to select freight shipping for his/her item. Even when I have another selection for setting
ShippingTypeCodeType.FREIGHT_FLAT (as it’s clearly documented here, to select freight shipping), the API returned this lousy “SEVERE: com.ebay.sdk.ApiException: At least one valid shipping service must be specified.” error when I tried to list the item.
This is just one example. Don’t get me started on my story about how two different classes have the same method (and supposed to return the same object) but don’t, or how the Javadoc for the SDK are mainly just unexplained collections of attributes and methods. You’d be surprised at the number of hairs I’ve lost over these darned inconsistencies. And the project is not even due yet.