January 8, 2009

Success with two different APIs

By Chris Heiland

This was originally posted on Chris Heiland’s staff blog while he was a member of the Web Team. Chris migrated this post to the Web Team blog before he left because we thought the content still had value to the UW community.


I ended yesterday with two different success stories communicated with two entirely different systems. The cool part is I did it with a scripts written in python.  The first system was SOAP based, the second was REST. Both used XML in some form to communicate.

The first success came late in the day when I authenticated with the Alert System via their SOAP interface. I should clarify; I have communicated with the system for the past week or so, but yesterday I actually got something back other than an error message.

I tried to use some of the python SOAP libraries to make my life easier. Well, since many of them are not in active development or are in alpha stage, my outlook was quite grim. I tried a few and didn’t have much success. Then I tried sending XML via a POST request, that didn’t work either.

I alternated back and forth between sending the request manually and using the libraries to do my bidding.  After several days of this I finally tried encoding the password in a CDATA tag. Success! Something vary simple to overlook and sure enough I did.

The second was dealing with the Netflix which uses mashery to offer an API. I should clarify as this may not use XML specifically as I really have not delved into how it truely works. The script I am using is an example offered through their downloads section.

I tried a few scripts to no avail until I noticed the one I am using now. After tweaking it slightly I got it working. The next stage of success will come after I understand oauth a bit better as I know very little about it now. There is a response trade similar to how openid authentication works I think.

Either way I had some successes and it made me happy. The next joy will come when I figure out what to do with all of this information.

Leave a Reply