Taking a look at the Ebay API's

Work has been quite challenging as of late but I finally have some spare time on the weekends again. One of my planned tasks have been to integrate Ebay listings into SiteFinity. This was something that our charity originally requested during the charity event in January but we never got to it. Now after I've had a chance to look into Ebay's API, I can tell it would have been impossible unless I had known then what I know now about their API's.

Ebay has a developer web site which describes all the various API's they have available and sample code. They have different types of API's depending on what I intend to do, i.e. if you want to sell or buy or look at historical data and so forth. They also have a number of different stacks you can use depending on your platform: library based, SOAP based, XML over HTTP and REST. Their site is a little messy and I couldn't find anywhere where they show all the options you have, you have to dig around. I decided to use the Trading API based on what I am interesting in doing and decided to use the SOAP API.

I first downloaded the SDK for .Net with samples to take a quick look. Apparently, all the samples appears to be using their library. Surprisingly, the samples were built with VS 2003/.Net 1.1 and it was not a smooth process to VS 2008/.Net 3.5. Apparently they have a dependency on the J# Redistributable Package so I had to search their forums and download the Redistributable Package just to be able to even compile the sample. Bad customer experience. However, they have some samples that are more up-to-date in the Knowledgebase and other sections at their developer web site.

I'm a little surprised how companies like Ebay and Amazon appear to be pushing their libraries if you want to integrate with them. Is that what developers actually ask for or is it just a bad idea conceived by someone in their marketing departments? I don't like to add a dependency on a third party library unless it has a compelling set of features that really makes everything so much easier. In this case because it appears that they want to have some of the assemblies in the GAC and my code will be hosted at a hosting provider, it seemed like a bad idea to me. Maybe I haven't looked into it in enough depth but I don't see that it's much easier than just using one of their other API's directly.

I decided to either to use their SOAP API or their REST API. I'm inclined to call their "REST" API a STREST API since it's not resource based at all, you just dump the request at one service endpoint which really defeats the purpose of using REST. Their SOAP API is not a lot better, it consists of one single massive 4 MB WSDL file. Their API's just seem to be based on their old XML over HTTP technology and the only thing that is different if you use a different API is the notation. You have to specify both the operation you want to invoke and the authentication in the service endpoint like this:

https://api.ebay.com/
wsapi?callname=AddItem&siteid=0&appid=myappid&version=511&Routing=new

This is a poor design IMO, there's no reason why they can't derive the operation and authentication from the message. If you use their SOAP API, you have to specify both authentication and the operation you want to invoke in the SOAP body as well. I'm disappointed in their design decisions and I hope no one uses Ebay as a good example to follow. Frankly, I had expected a lot more based on their good reputation in general.

If you decide to use their SOAP API or their REST API, I recommend you use a web service testing tool to verify that your calls work correctly instead of having to write a bunch of code and running into issues and either having serialize the request or have to use a HTTP Proxy tool to be able to troubleshoot it. I prefer using soapUI because the rich feature set and that they have a free version but there are a number of other tools you can use, I'm not aware of any other free tools though. SoapUI also has a professional version with more features but I have never looked into that. Here's an example of the GetCategories call in soapUI:



However, some of their other operations are quite complex like AddItem. It might be more benefical to just use a tool like this to easily see all the options instead of trying to get it to run because of the large number of options. Thankfully, they have really good documentation online that describes all the various options and the available values when it's restricted.

In my case, the operations that are of interest to me is GetCategories to get all the various categories and AddItem which lists an item at Ebay. Now when I have figured out exactly what operations I need to invoke for the functionality I am interested in, I will try to get it to work in SiteFinity.

  1. gravatar

    # by Andrei - March 27, 2012 at 4:15 PM

    Hey, i'm new to this, and i was wondering if you can help me with something. I have a school project and i need to make a website where, amongst other things i need to get data about product from ebay and display it on my website. The thing is i need the output file to be xml format (by this i mean the file that is sent back to me after the request has been made). I read that REST is URL based and SOPE is classic, Http transfer based. Which one would you reccomand for a rookie like me?
    My email adress is ska_andy_tm@yahoo.com . I have more questions, but this comment is to long already.
    Nice post btw. :)