Archive forGeneral

Web Services At A Crossroads

I've just read an interesting article by Daryl Plummer: Web Services At A Crossroads. It's an interesting discussion about web services (SOAP, WSDL) vs. new emerging solutions like Plain Old XML (XML) or REST. No word yet about JSON, AJAX or other solutions.

In my opinion, any of these technologies work just fine, as long as they solve real problems. There are quick and easy needs for communication channels, when new solutions are just fine. From the security point of view, I think all of there are the same: they all could enforce rules or have leaks and breaches. And many times security is not even an issue.

The most important issue, in my opinion, would be a standardized solution available on multiple platforms and an assurance that these technologies will be available in next releases of the hosted applications or working interconnected. But these problems are not easy solved for any of these acronyms, either SOAP, WSDL or REST, or others. New solutions rely on specific implementations that can change over time.

Instead of 'web services' I think a more correct term would be 'web API', which include more than just client-server communication. This is reflected by new Web APIs Working Group of W3C and new developing projects from various companies when many times new access solutions are called simply 'API', instead of 'service' (see Google, Yahoo, etc.).

Comments

del.icio.us API

You know what del.icio.us is: a social bookmark service, now bought by Yahoo. You can create a free account and add your website bookmarks, even share with others.

They also released some API, but in my opinion very limited. All you can do is to manage your own bookmarks (links) with their tags and bundles. You can't do searches on popular websites and tags, or last added bookmarks.

To use it from any application or website you need a free account. All API help files are available at del.icio.us/help/api. They also provide HTML, RSS, JSON & JavaScript access (see help page).

The most important function (page), I think, is posts/add, which add a new link to your online account. You can do this operation from your browser openning

http://username:password@del.icio.us//api/posts/add?url=…&description=…URL title…&extended=…URL description…&tags=… tags…

 

You can create such a link even from JavaScript and call this page. One simple solution from JavaScript is to use new Image(), even if the value returned is not an image:

var img=new Image();
img.src='http://..full URL as above …';

When everything was done right is returned

<result code="done" />

otherwise would be:

<result code="something went wrong" />

Here's some PHP code to add a new bookmark to your account, in 2 simple ways:

function deliciousAdd($user, $pass, $url, $description, $extended, $tags) {
  $r=file("http://{$user}:{$pass}@del.icio.us/api/posts/add?url=".urlencode($url).
     "&description=".urlencode($description)."&extended=".urlencode($extended).
     "&tags=".urlencode($tags));
  return ($r[1]=="<result code=\"done\" />");
}

function deliciousAdd2($user, $pass, $url, $description, $extended, $tags)
   {
   $domain="del.icio.us";
   $socketConnection = fsockopen($domain, 80, $errno, $errstr);

   if (!$socketConnection) {
 echo("Network error: $errstr ($errno)");
   } else {
       $tmp = '';
       fputs($socketConnection,
 "GET /api/posts/add?url=".urlencode($url).
 "&description=".urlencode($description)."&extended=".urlencode($extended).
 "&tags=".urlencode($tags).
 " HTTP/1.0\r\nAuthorization: Basic ".base64_encode($user.":".$pass)."\r\n".
 "Host: $domain\r\nConnection: close\r\n\r\n");

       while (!feof($socketConnection)) {
           $tmp .= fgets($socketConnection, 128);
       }

       fclose ($socketConnection);

   }

return(strpos($tmp,"<result code=\"done\" />"));
}

They return TRUE or FALSE, depends on the response and could be use like:

deliciousAdd($username,$password,
    "http://Yahoo.com","Yahoo!","Yahoo","yahoo");

deliciousAdd2($username,$password,
    "http://Yahoo.com","Yahoo!","Yahoo","yahoo"); 

Simple, isn't it?

Comments

Welcome to WebAPI.org

Welcome to WebAPI.org

First of all, what's WebAPI.org? It's a free website focused on Internet services available online from different providers, using different technologies and methods. This is a directory of such APIs, with script samples, links and reviews.

More and more companies offer web APIs for useful purposes, in order to expand their client base and enhance other developer applications. For them, it's just another method to bring new visitors or keep satisfied their clients. For users, is a good source of online service, many times for free. For developers, is a challenge to keep their applications up to date with latest technologies and more functionality.

There is not an easy definition of what Web APIs are, and even there are no standards for many solutions or W3C recommendations for them, but we still must know what they are and how to benefit using them. It's like integrating solutions from multiple companies in a dynamic and useful product. Results could be spectacular and can ease our work.

We'll try to offer here details on what a web API offers, how to use it, samples and links.

Web APIs are a very hot and dynamic topic, so, almost every week there are new solutions. We'll try to keep up to date as possible, but still there is no promise. Thanks for helping us with information, correction or comments.

Comments

Next entries » ·