Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

APIs and Services come full circle

DZone's Guide to

APIs and Services come full circle

· Cloud Zone
Free Resource

Site24x7 - Full stack It Infrastructure Monitoring from the cloud. Sign up for free trial.

Back in 1996 when I joined an EDI company as a programmer, the first thing a colleague did was put the definitive Windows API reference, Programming Windows by Charles Petzold, on my desk. At the time we programmed for Windows 3.1 (and for something called "DOS Windows" - don't ask...). I can remember the excitement in our small programming group when the 5th edition of "Petzold", as we called it, came out. This heavy tome was "The definitive guide to the Win32 API".

At the time, an API was understood as being for C++ or Visual Basic. MAPI (the Mail API for Windows) is a good example. At the time I would write EDI clients using ISOCOR products, and one in particular, Personal ISOTrade, implemented the MAPI API. So, with that product, all we had to do was implement that API to send EDI messages (EDIFACT and HL7) over X.400. I also did Java programming at the time, and used Java toolkits (e.g. J/Crypto which was a full-strength JCA/JCE implementation) but these were toolkits or implementations of interfaces, not quite the same as "APIs".

Fast forward ten years. Service Oriented Architecture principles took hold, even if the name "SOA" remained controversial. The notion of Services replaced APIs. You may still use actual programmatic APIs, but the understanding was that what you were really using is a service which shouldn't be tied to a particular language. This kind of thinking was liberating, and opened up all kinds of possibilities. Gradually the APIs could be exposed in a more widely-usable way. And we talked about "services" not "APIs".

Daryl Plummer put it well that "someone told me, “if you’re over 30 you call it an ‘API’, and if you are under 30 you call it a ‘service’”)

But then what happened? It came full circle. In 2011 when we talk about "API's", we mean Web APIs like the ones on this huge list of Web APIs. The kids are now talking about APIs again, but not in the way that we did 15 years ago. Take for example the USA Today Sports Salaries API. Are you interested in finding out how much a particular US sports player earns? Then this API will get the info, using a HTTP request and receiving the response in JSON or RSS (XML).

One big difference between the C++/VB APIs of old and the Web APIs of today is that API management and security wasn't something that was considered 15 years ago. There were exceptions, such as crypto APIs which included controls against attackers swapping in their own implementation of the API as an attack. But mostly the APIs were called under the context of the user's application, and security was at that level (i.e. "The user must have logged in to use the app"). And usage of the API was usually not tracked.

But now, API management and security is important. To see why, check out that USA Today Sports Salary API page again. Access to this API is managed using an API Key:
Every call to the USA TODAY Salaries API must be authenticated with the programmer's unique API key, as in this sample request.
http://api.usatoday.com/open/salaries?api_key=XXXXXX

USA Today uses this developer key to limit access to their valuable sports salaries database to just 1000 requests per day. However, the API key in the example above is sent over (yikes) plain HTTP, so an imposter could sniff someone else's API key from a message and then use it to suck down sports salaries on their account. All of this points to the need for API management and security. Fortunately there are options for API security, so that exposing a Web API doesn't have to mean hanging your data out for the world to access over plain HTTP. With a service gateway it is quite trivial to create a policy that enforces SSL, enforces usage limits, and provides API monitoring.

One of my favorite Web APIs to use in demos is SalesForce.com . SalesForce has a ton of information about their API on their developer site. Vordel can be used to connect up to SalesForce, including sending up the API Key and caching the Session Identifier which is returned back by SalesForce.

One of the neat things about this is that all traffic from the app to the SalesForce API is now authenticated and monitored, and shown in the browser, as shown below:



So APIs and services have come full circle. 15 years ago, it was all about APIs. Then it was all about services. Now, we talk about APIs again, but mean something different than we did back then. Security and management of these new APIs has reared its head, but the good news is that there are solutions to this.

Site24x7 - Full stack It Infrastructure Monitoring from the cloud. Sign up for free trial.

Topics:

Published at DZone with permission of Mark O'Neill, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}