Published
Monday, October 29, 2007 6:27 AM
by
martin
Windows Live offers a RESTful API for applications to access individual users' Windows Live address books. If this is news to you, please start here on MSDN, or see my earlier post for more details. This API is implemented via a service called Windows Live Data, and in the fullness of time other interesting data will be made available in the same way.
If you want to retrieve data, it's simply an HTTP GET, with an appropriately-formed URI, not forgetting the Authorization header. However, if you want to insert or update a contact record (or part thereof) you have to form an XML payload that you can POST or PUT to the service. If you have formed your XML badly, there's a fair chance the service will respond with a 500 "internal server error", or possibly some other error code that doesn't point you directly to the problem in your XML. When you start to use this stuff, the chances are good that you will make some mistakes in forming your XML, so how can you debug, given that the error codes from the service don't help much...?
The best approach I've found is to use http://www.randomthirdparty.com. Select the "Normal Case" option and it will retrieve your address book contents. Now, at the bottom of the page, you have the option to edit the HTTP request, including the authorization header, and you can put any payload you like into the request. You can submit and view result.
I found that by using this tool, editing my payload and re-submitting, checking the response codes against the list here on MSDN, I soon got my XML into the right shape.