the singularity of being and nothingness
Posts tagged Web Services
Quick Look at ScrnShots' API
Jun 4th
A few months ago, I ran across ScrnShots. It's basically a service for uploading, tagging and sharing screenshots of websites. This is pretty useful for me given my profession :).
One of the things, however, that has always impressed me about the site is how easy and fun to use it is. It features really deep networking capabilities, the tagging is pretty robust, and everything is fast, fast, fast!
Of course, while uploading from the site is easy, I've been waiting with baited breath for them to release an API. Well, recently this happened, and I couldn't be more excited!
The API is alot like Twitter's in that it uses Basic Authentication for user-specific http calls. While not the most secure form of authentication, it is ridiculously easy, especially if you're using ColdFusion whose cfhttp tag has a built in mechanism for managing it.
So tonight, I spent a couple minutes digging into the API, and came away with an easy function for uploading, tagging and providing a description and link for an image. And of course, if you're using ColdFusion, it's cake!
Here it is:
<cfhttp url="http://www.scrnshots.com/screenshots.xml" method="POST" charset="utf-8" username="existdissolve" password="password" multipart="yes"> <cfhttpparam name="enctype" type="header" value="multipart/form-data"> <cfhttpparam name="screenshot[uploaded_data]" type="file" file="#filearea#" mimetype="image/jpeg"> <cfhttpparam More >
Webservices in ColdFusion
Sep 18th
Today, for work, my boss asked for me to create a bit of functionality that would allow users to return lists of people from a database who live within [x] miles of an entered zip code. I've never created something like this before, but I've been around long enough to know that this kind of functionality requires gigantic databases of zip codes, trigonometric calculations, etc. simply to return the distance between two zip codes.
Fortunately, others have created such things and have kindly sydicated them as webservices. Webservices are very simple–they are a collection of functions that are remotely accessible to developers. So, if you want to create a search for Amazon books on your website, you hook up to Amazon's book-syndication service, call the appropriate method (like "getBooks()" or something) and use whichever programming language you is using to parse out the information in a usable fashion. Here's the one I'm using:
http://webservices.imacination.com/distance/Distance.jws?wsdl
ColdFusion makes stuff like this ridiculously easy within its "cfinvoke" tag. In about 4 lines of code, you call the method, pass in the method's require arguments, and create a variable for usage later on.
<cfinvoke webservice="http://webservices.imacination.com/distance/Distance.jws?wsdl" method="getDistance" returnvariable="distance">The zip code webservice required two arguments, "fromZip" and More >