Wednesday, December 17, 2008

Picasa Web Albums Data API

(My Original Blog Post: -*http://api-madness.com/post/picasa-web-albums-data-api/)
[youtube]http://www.youtube.com/watch?v=hgadtxgXZ_k[/youtube]

Attention! API Garbage (might be unreadable):

photos image photo

Are really just a mystery am going to introduce you to the Oslo TV Guide which gives you the ability to access and manipulate the data stored within the Picasso of album service this data includes items such as albums photos common syntax I m also going to show some examples of the cool things you can do if you got in case you haven t used it yet possible about this is Google s free photo sharing site that allows you and your family and friends to quickly and easily share photos with each other and with the world in great albums of photos to share with your family or friends tag your photos are a geographic information and comments photos authors know what you think and you can do all this with the API to have your heard want to just jump right in with the code@Google.com to check out the documentation gets to your three ways developers typically interact with the API first by using a guide to view and explore existing photos to your others up a second uploading your photos or creating new albums and third by editing your own photos implemented first off let s look at how to view a list of albums for user here is the URL you would use to access users out operator you are all down in part because most of your stays the same but requests the first euro of cost web that will accomplish data is the base of the API is always the same for all possible about the API requests the second reviewer also at the collection that use request the collection type is either feed and your media and in our initial examples will only be using the feed collection type all discussed other collection types later on in the third-party euros projection which identifies what subset of data to return in our examples will be using either the base projection which is used for read-only HTML view of the data or the API projections which includes all the metadata is used for read/write API access the final part of euros the context this identifies what resource on the server you are interacting with in this example were acting with an individual user so the context includes just the user will see some of the other context than the following word he tells on your format and additional options such as programmers please visit reference retrieving the list of photos in the album is very similar to retrieving the list of users out we just take our existing euro and had one of our album might use like this here s an example response with much of the data removed to make it easier to display the photos come back in the entry elements with each photo entry containing all of the metadata about a photo including information such as the dimensions of thumbnail euros useful for embedding in a webpage a list of the tags the photo caption and more another common use of the API is to make it easy to access photo search results by using the all context and adding a query string you can search for all kinds of photos across her community search results for example you can search for photos tagged with dog in pairs by adding Paris as the Q. parameter and dog as the tag parameter like this if we use the base projection and enter the square into a browser that understands atom feeds usually get back there are many other such options such as adding a geographic bounding box to search for results in a particular area or limiting the search results to photos from your favorites or even from individual user or album all of the search options are documented in the reference now let s take a look at an example use of the album and photo feeds bookmark application Butler so here we are inside the books when application of the consultants use via us will miss TV Guide import photos into application which you can do by clicking the get photos button appear and treason cost ones who just enter used in the password you use client log into effect to the Oslo bombs and download your photos personals of all the photos in all albums but then we can choose to go out and we said earlier with some images once and then we click select all and just click downloaded imports is photo strictly not wish to consume left the images and can just drag-and-drop them right into the book this is a title page to good mental picture of Hunter Narron and we choose the back page and add an image in the connector sales of the book in print up while it s great to be able to view existing photos and search for interesting content we also want to be able to upload new photos to do this we just post the data we want to send inappropriate feed your easiest choice for uploading is to just use the drop box which is the default album the new photos go into another droplet to the drop box you can either post the image to the user euro or post them and should help him euro without my decent default like this you can also choose exactly which I m droplet to the using albums ID in the URL in addition to deciding what album to post image to you also need to decide how to format the request they re currently two choices for upload for you can either post the photo bytes directly to the selected URL or you can post to both binary data in XML metadata using a single mime multipart related request if you are sending just the image bytes make sure to set the content type header to the appropriate type you can check out the list of supported types and reference you can also optionally set a slight header which allows you to set the title of each if you want to send both the image bytes and the image metadata in the same request you need to create a multipart related request and post back of your here s an example of a multipart related request which sets the title and caption the photo at the same time as the photos up with once again you can check out the full details in the reference going to quickly walk you through example of uploading a photo using the Java climate the other climate versus emergent abilities as always you can do all this directly using HTP axman the first thing we do is create a possible service object and then we call the set user credentials method which will handle all the authentication handshake and using client log you may also choose to use the off summer off authentication mechanisms which are also fully supported by the climate works you can view a complete list of available authentication mechanisms by going to code that will accomplish API/account another worth panicking need to pick an album to upload to do this we call the guaranteed method on the service object with the euro were trying to treat which in this case is the list of albums euro which is the daughter of once this method has executed to get McAfee object that we can use to get a list of commenters which we can then present your user to allow them to choose the upload destination from the album entry and get a link to the album feed location which tells us where to post new images then we just create a media file source using a local file and call the insert method on the service object with the destination URL and the media source image will be uploaded and a photo Hunter returned to us with a new photos ID and other magic this example uses the direct posting method of posting image bytes using the climate were to post a multipart related body is just as easy to know he seen how to view our existing albums and photos and how to upload new photos but what about ending our photos is also easily accomplished using the API to modify an image just put the new image bytes of an immediate link that was returned from the last get or post that photo at a media link look something like this most of the questions I appears media to the service know that you want to edit image bytes direct in addition to updating the photo bytes sometimes you want to update the photo metadata such as the photo s caption title or text you can do this through the normal edit links putting either just the new metadata or a multipart related body containing both the new metadata and the new image Ural to use for updating this content is very sorts the world for updating just image bytes but with entry is a question type instead of media now take a look at a great application and uses the added features of the API picnic.com this application also uses the other capabilities I discussed earlier including retrieving list of albums and photos and uploading it once so here we are inside.com and we ve already used pics interface with possible bombs to importer for those pounds of loaded up a picture of Einstein here in the edit view to go to the preview to time makes a modification to conceal the tools unless either the technical Jews born Jews would pick the control to change and send color McCumber will do we choose the color in the bleachers mode is hardly better than we have a meeting and click apply and has performed so we actually want to save Einstein back up to possible problems on serenity McCutchen and then we can actually choose to save the new file this uses the upload API he actually sends multipart related to include both metadata and the original image bytes at once so abundant if we go over to possible bombs would actually refresh the page and see a pseudonym to the real Lussier knew an image and caption within single back to picnic and makes more changes to this looks as go ahead and make Einstein neon purple actually taken neon green cuts risk of quick applying time we go back to save and share that were not change the caption him this time I should receive it in place of the old file rather than as a new one so it actually makes us confirm you want to do that and click okay to save the image back at Oslo s to go back and hit refresh and see the new image Art so when I m sure you re busy coming up with the next great application that uses the possible about David for a lot of things that I didn t cover several more information please check a developer guide and arrest the documentation I told the luck you can also be less informed ask questions or to show for you great thanks and happy to

No comments: