Wednesday, May 2, 2012

REST API & DLL Demo

This demo shows the usage of both a representational state transfer application programming interface (REST API) and a dynamic-link library (DLL).

The REST API I used is "The Cat API" by Aden Forshaw.
Check his website out here:
http://thecatapi.com/

I made this mostly for fun, because who doesn't love cats?
What it does is: it makes a web request using the Cat API for a user-specified number of cat pictures.
It then attempts to download all these pictures and sets them as your desktop background.
Why? I have no idea, but it's pretty funny.
Also, the main program makes use of a DLL, which does most of the work behind the scenes.
If you don't know what a DLL is, think of it as a kind of pseudo-program or set of instructions that are called by another program. The main idea behind DLL's is that instead of having to update an entire program during or after development, you can just update a DLL, which makes the whole process much nicer by compartmentalizing things.

Anyway, check out the video on YouTube to view it in HIGHER THAN HD! (so you can see what's going on)
Also, if you're wondering why there were only 96 pictures, it's because some links might be dead or couldn't be downloaded. You may also be wondering why not all the images get set to the desktop. That's because some of them are .gif images, which cannot be set as the desktop in Windows 7 by default.

Anyway, if you want to check it out for yourself, here is the link to the VS2010 project and source code on GitHub: https://github.com/MobiusR/REST_dll_cats/
There's also some pretty dirty string conversion in there, so brace yourself.