REST in the cloud


Many consider APIs to be the best method for organizations to access services provided by cloud computing vendors. Cloud consumers use APIs as software interfaces to connect and consume resources in various ways, though the optimal or contemporary route is to use a RESTful protocol-based API. Read on to gain an understanding of what APIs are and how they are used—particularly when it comes to REST APIs and cloud computing services. This article provides several use cases that demonstrate how this technology is used in the real world.

API primer

APIs are software interfaces that optimize development of an application or service for data processing. Often developers can import or integrate APIs into an existing code library through header files. However, with the advent of web services, developers are creating APIs to couple the ability to publish or consume web-based services with third-party system software.

As technology has matured, technology companies and functions have moved — or at least have tried to move — to a service-oriented architecture (SOA) model. This model allows for the development of web services using object-oriented programming languages that developers can call and reuse as appropriate. The Google Maps API is an example of a web-based API that allows developers to call and consume this service as appropriate in their application or website.

Structure of an API

Developers need to follow best practices and standards to correctly develop, publish, and consume APIs. These best practices and standards rely upon a basic structure that is dictated by the programming language the API is built for, namely: Java™, Microsoft® .NET, Objective-C, JavaScript Object Notation (JSON), or Extensible Markup Language (XML). Figures 1 and 2 are examples of XML-based APIs.

Figure 1 is PAID’s shipping API, which allows organizations to tie this functionality into their eCommerce sites.

Figure 1. API used for shipping and logistical purposes (graphic used with permission from AuctionInc)
API used for shipping and logistical purposes

Figure 2 is Instra’s API, which allows organizations to connect directly to their domain registrar for infrastructure purposes.

Figure 2. API used for domain hosting purposes (graphic used with permission from Instra Corporation)
API used for domain hosting purposes

Beyond the programming language used, the API also needs to take into account the nature of the service itself. In other words, there are different rules to follow if the API is created for client-side versus server-side consumption.

Whether the API is built for client-side or server-side consumption, a reality for developers is that the service needs to be built for high performance and with secure processing in mind. Developers of client-side APIs naturally focus on the user interface, aesthetics, and the look and feel of the application. Developers of server-side APIs deal with enhanced functionality or services for the original application with function in mind. Regardless of where the API will be used, today’s developers lean toward using RESTful APIs because of their flexibility and versatility.


RESTful APIs follow the SOA model and, therefore, are often used by web service-based software architectures through XML or JSON for integration purposes. This means that they are consumed through an internet browser or by web servers. As mentioned before, RESTful APIs are a relatively new technology requiring developers to have a thorough knowledge of current Web 2.0 technologies. Therefore, many organizations lacking an impetus to update their technology stack may not have the option of using this offering. Examples of organizations that may not be focused on RESTful APIs these days would certainly overlap with those not looking to become cloud consumers. These may include law firms, higher education institutions, and nonprofit groups. However, RESTful APIs are a reality that is here to stay.

Technology has come full circle in the sense that the majority of processing and storage resources have been pushed away from the end device, much like the days when mainframes and dumb terminals were prevalent. This is due to globalization, an increasingly remote or mobile workforce, ubiquitous Internet connectivity, and the maturity of SOA and Web 2.0 technologies such as RESTful APIs. With the addition of cloud computing used for data processing tasks through APIs, this trend is moving toward critical mass.

Cloud computing and APIs

Cloud computing services by nature are distributed. So, the use of web-based RESTful APIs by consumers is a logical solution for the remote consumption of data processing services. And, when economic downturns, emerging markets, and lower barriers to entry for competitors are brought to mind, it is not hard to understand why there is a renewed focus on technology for competitive advantage.

REST APIs are essential as businesses try to gain or keep a foothold in their industries or markets while dealing with globalization, an increasingly remote or mobile workforce, and ubiquitous Internet connectivity. These realities have created vastly different end-user requirements that need to be satisfied. The cloud is helping businesses realize these new priorities. However, for an organization to properly use the cloud, the technology staff should understand the nuances of cloud computing, as well as some common use cases for using the cloud or cloud service provider (CSP) API solutions.

Cloud computing overview

With regard to RESTful APIs, some cloud service delivery models have more RESTful APIs than others, namely SaaS and PaaS models. These delivery models focus on delivering software solutions for consumers, while infrastructure as a service (IaaS) focuses on infrastructure services (for example, compute or storage capabilities). Most RESTful APIs lean toward SaaS solutions, though there are numerous RESTful API solutions available for PaaS consumers as well.

PaaS models allow for the development of an application on top of an existing service (for example, database as a service, or DBaaS), while SaaS solutions focus on a specific application type. Examples of PaaS include Amazon Web Services (AWS) Relational Database Service (RDS) and’s offering. Examples of SaaS solutions include Zoho Writer and Microsoft Dynamics CRM.

While REST APIs are more prevalent in SaaS and PaaS solutions, there are RESTful APIs for IaaS solutions as well. Most of the major cloud vendors (AWS, Rackspace, and so on) offer RESTful APIs for managing and administrating their IaaS environments, which cloud brokers such as RightScale leverage for their instance monitoring dashboards.

Sample cloud REST APIs

This section covers several sample cloud-based RESTful APIs to help you better understand how CSPs publish their RESTful APIs for consumption by cloud consumers.

Listing 1 is a sample IaaS-based RESTful API from AWS S3 for Domain Name System (DNS) redirects (for example, redirecting to You can leverage this API within a Java, .NET, or XML-focused integrated development environment (IDE).

Listing 1. RESTful API example (from AWS Documentation)

HTTP/1.1 307 Temporary Redirect
Location: http://johnsmith.s3‑
Content‑Type: application/xml
Transfer‑Encoding: chunked
Date: Fri, 12 Oct 2007 01:12:56 GMT
Server: AmazonS3

<?xml version="1.0" encoding="UTF‑8"?>
  <Message>Please re‑send this request to the specified temporary endpoint.
  Continue to use the original request endpoint for future requests.</Message>

Listing 2 is an example of using Hypertext Markup Language (HTML) to call a RESTful API from Netflix for catalog searches. This solution is offered as a PaaS solution that you can use to create an application that calls the Netflix API for catalog searches. Use case examples include an entertainment dashboard or a brokerage service for gaming.

Listing 2. Calling Netflix’s RESTful API via HTML (from Netflix API Programmer’s Guide: Common Rest API Tasks)

<head><title>Simple Search Page</title></head>
  Response resp = null;
  Strong sTerm = request.getParameter("term"); ← Get search term
  if( sTerm != null ) {
   String sRequest = ← Build request
    resp = DemoApp.getService().call(
        sRequest, Method.GET, null); 
 <tr><form action="simplesearch.jsp"><td></td>
  <input type="text" name="term" />
  <input type="submit" /></form></tr>
  if( resp != null ) {
   DomRepresentation rep = resp.getEntityAsDom();
   Document doc = rep.getDocument(); ← Get the response
   XPath xpath = XPathFactory.newInstance().newXPath();
   NodeList nodes = ← Evaluate the response
   (NodeList) xpath.evaluate(
                          "/catalog_titles/catalog_title", doc, XPathConstants.NODESET );
   for( int i=0, n=nodes.getLength(); i<n; i++ ) {
    Node node = nodes.item(i);
       Retrieve the data of interest:
       String sTitle = (String) xpath.evaluate(
                                         "title/@regular", node, XPathConstants.STRING );
    String sImage = (String) xpath.evaluate(
                                         "box_art/@large", node, XPathConstants.STRING );
    String sID = (String) xpath.evaluate( "id/text()", node, XPathConstants.STRING );
<tr><table>tr align="center">
 <img src="<%=sImage%>" /><br />
  <%=sTitle%><br />
  <form action="addToQueue.jsp">
   <input type="hidden" name="title_ref" value="<%=sID%>" />
   <input type="submit" value="ADD" />
  </form><br /></tr></table>

Cloud and API use cases

There are various use cases for how cloud consumers leverage cloud-based RESTful API to their advantage. This section provides several examples of how organizations consume SaaS, PaaS, and IaaS RESTful APIs.

Google Maps Coordinate is a SaaS-based RESTful API service that you can use for a mobile workforce. An organization can leverage Google Maps Coordinate as is or in an aggregated fashion with other applications (called a mash-up) to route drivers and coordinate pickups and deliveries. Any business that requires a dispatcher may be able to use this service via tablets or smart phones for enhanced productivity.

While on the topic of productivity, organizations that have more experience and resources dedicated to application and system development will be happy to hear that Amazon’s DBaaS (AWS RDS) platform supports RESTful APIs as well. This functionality allows developers to call, manage, and administer Oracle, Microsoft, and Amazon-based relational and non-relational database solutions without having to use a management console. Organizations who want to have more operational control from an operating system perspective can consider IaaS-based RESTful APIs.

For those consumers that use IaaS CSPs, rest assured that most provide RESTful APIs for this delivery model as well. IBM, Fujitsu, Amazon, and others have led the way with this functionality. These services allow consumers and cloud brokers to monitor and automate the provisioning of services in a manner that is truly elastic and on-demand.


Cloud computing and RESTful APIs are upon us, and it behooves your organization to determine how to leverage these technologies for cost savings from a capital expenditure standpoint or enhanced processing. To do this, your organization has to embrace Web 2.0 or SOA technologies and some or all of the cloud delivery (SaaS, PaaS, IaaS) and deployment (public, private, hybrid, community) models. By securely embracing these new paradigms, your enterprise will experience enhanced levels of flexibility and adaptability.

Economic downturns, emerging markets, lower barriers to entry, globalization, an increasingly remote or mobile workforce, and ubiquitous Internet connectivity are the new reality. To compete and thrive in today’s marketplace, your organization needs to leverage these new technologies as appropriate. Most firms can start by using the cloud and REST APIs.