This is the third post in the series on accessing Live Services from Compact .NET Framework applications. So far we have covered authentication and Live Contacts. The next service we are going to discuss is Live Photos.
There are 2 separate APIs available for working with Live Photos. One is WebDAV-based and the other is ATOM API. While both can be used successfully to upload photos, create albums etc, WebDAV is generally considered to be deprecated in favor of more modern SOAP APIs such as ATOM Publishing Protocol.
Photo ATOM documentation tells us that the format of the ATOM request for Photo access is as follows:
[METHOD] /[path to resource] HTTP/1.1
Host: cumulus.services.live.com
User-Agent: [Name of the user agent, typically the client app or service.]
Authentication: DelegatedToken dt="[delegation token]"
We are going to use it with one modification. Instead of Authentication: DelegatedToken dt="[delegation token]" we will add Authorization: WLID1.0 t="[auth token]".
Similar to what we have done previously, the [path to resource] part is constructed as /[live ID]/[Service]/[Path to item] where [live ID] is the WLID of the current account (e.g. someone@live.com), [service] is AtomSpacesPhotos and [Path to item] is a combination of Album and Photo identifier. And example of a folder URL:
https://cumulus.services.live.com/someone@live.com/AtomSpacesPhotos/Folders(231)
An example of a photo URL:
https://cumulus.services.live.com/someone@live.com/AtomSpacesPhotos/Folders(196)/Photos(200)/$value
This one has content type image/jpeg. It returns image binary stream in jpeg format. An HTTP POST to the above url with the request body set to the image binary stream and content type set to image/jpeg will update the image.
To retrieve a list of all top-level folders use https://cumulus.services.live.com/someone@live.com/AtomSpacesPhotos/Folders.
[this is work in progress. to be continued. code samples coming shortly]