November 2012

How To Expose Internal Systems As REST

How To Expose Internal Systems As REST

To expose internal systems as REST, you must first understand the value of resources and controllers. Once resources and controllers are understood, thinking in the abstract is next. Abstract thinking (thinking about the parts instead of the whole) create value for the developers you are trying to attract.

Consider as an example a Bird and a Dinosaur.  Each creature has attributes and behaviors that make them distinct. They also have shared attributes (such as seeing and walking). Let’s say for illustrative purposes that Bird and Dinosaur are finished products (in the same way internal systems are finished products).

In the diagram below, Bird and Dinosaur have been deconstructed (as a simple example). This deconstruction allows us to create new unique animals and apply behaviors, such as walking and flying, to the unique animal.

Animal Deconstruction


To monetize internal systems, you must think similarly about abstract deconstruction. Deconstruction produces a framework that allows developers to create unique applications. However, one must not confuse REST and API as the same. REST is an architectural style that uses the HTTP URL to access information. URLs can be consumed by APIs or accessed as RAW URLs. Let’s not lose sight of what REST stands for; Representational State Transfer, which means transferring the state and make-up of data via a URL.  REST’s ideal purpose is for data.

Now let’s look at a more concrete example. If a company wants to gain developer adoption, decision makers would align assets so one asset alone would not accomplish much. However, one asset combined with other assets would create something interesting and viable. Instead of looking at the enterprise as a whole, try to look at each individual platform’s characteristics and behaviors in the abstract as shown in the diagram below.

Deconstruction Example

From the abbreviated diagram above, as a developer, I can now begin to imagine mixing and matching the various attributes and behaviors into some type of software product, or incorporating attributes and behaviors into my own product. To focus on parts instead of predetermined functionality allows a developer’s imagination to flourish.

When each infrastructure asset independently evolves and gains a consistent interface the benefit to a company lies in monetizing exposed assets to external developers. After you have deconstructed  the internal systems, you then want to create unique offers (or products) to show developers how they too can use the framework to create their own products. In the diagram below, a telecommunication company could leverage Voice, Media and the SMSC to create a framework and possibly allow developers to create something totally new. Leveraging and monetizing internal systems can be done with the right mindset.

Why You Should Care About XML Schemas

Why SchemasXML schemas should not be confused with XML. Schemas allow you to set rules that apply to XML documents. Rules are good; especially, for XML documents. Schemas define the structure of an XML document. Rules also assist novice XML authors from making mistakes when adding content to an XML document because rules govern what goes in an XML document, and what should be excluded.

Developers often create schemas with optional XML elements. Which begs the question: Are you authoring the schema to determine its structure, or are you authoring a schema to define the rules for content added to an XML document?

If you are creating a schema to define an XML document structure, don’t.

Often XML schemas are reversed engineered from XML documents⎯NOT the correct way to author schemas. One should design a schema.  In designing, we must think about what elements are needed in an XML document. Considerations include how to structure the document, what rules to place on the data, and if only certain information should be allowed in the XML document. The proper way to approach schema design does not include reverse engineering an XML concept document to reduce typing.

Sorry, creating a schema is a dirty job. However, the rewards are bountiful when designed appropriately.  Appropriately designed schemas produce consistent XML documents, consistent content, reusable content, and structure content.

REST as Template Services

Template ServicesCompany management consistently struggle with exposing internal products as REST services. There is a lack of balance between organizing internal products to be used in combination with other internal products (to create a new type of service) and REST principles.  Understanding the difference between controllers and REST resources will eliminate confusion and misuse of fundamental REST principles.

Previously explained, REST is best used for static objects that Create, Retrieve, Update, and Delete  (i.e., the HTTP equivalent POST, GET, PUT, and DELETE). If the service acts as a function, consider designing the service as a REST controller (see How to identify objects as REST Controllers or Resources). Otherwise, the service is data.

The ultimate REST architecture is a service structure that combines with other REST services to create a totally new service as depicted in the following diagram:

A Powerful REST Architecture that Focuses on Monetization

REST Template Services

The platform is the application, or system exposed to external developers. Platforms are used individually or with other Platforms to create unique services.

The service template defines configurable attributes of a platform. The service template is used to create a service, which has commercial value to an enterprise or an independent developer.

The service variant is a configured version of a service template.  The service variant is an item with the necessary configuration to provide value to a developer and supports necessary provisioning actions.

An offer is a bundle of services exposed via an API, which consist of one or more service variants, offered to developers for consumption to create applications.

In summary, when creating a REST architecture remember one internal service can be used with another to create a completely new API.  Try to stay abstract. Do not release a finished product as a REST service by pointing the URL to the product. When a finished product is used as a REST service, a developer has no options to consume the API.  Separate data as resources and actions as controllers.  Nouns vs verbs.