API - Life Cycle Management PDF
API - Life Cycle Management PDF
by SMARTBEAR
Contents
Introduction.............................................................................................3
API Modeling..........................................................................................4
Develop a Model................................................................................................ 4
Conceptualize............................................................................................. 4
Define.......................................................................................................... 4
Resource .................................................................................................... 5
Define Success.................................................................................................. 5
Iterate................................................................................................................. 5
Pragmatic REST design key principles........................................................... 6
REST metadata formats an overview............................................................. 8
apiary.io..................................................................................................... 10
ioDocs....................................................................................................... 10
Swagger.................................................................................................... 10
WADL........................................................................................................ 10
WSDL 2.0.................................................................................................. 11
Selection Criteria....................................................................................... 11
Hypermedia APIs HATEOAS anyone?......................................................... 12
HAL........................................................................................................... 12
JSON Hyper Schema................................................................................ 13
API Quality...........................................................................................13
Functional Testing............................................................................................ 13
Service Simulation (or Mocking)...................................................................... 14
Security Testing................................................................................................ 14
Load Testing..................................................................................................... 14
To Summarize......................................................................................19
API Monitoring
by SMARTBEAR
Introduction
Just like many fellow developers and technology geeks, we were avid
Lego-builders during our youth. Those small plastic pieces gave us the
possibility to create anything our imagination had in stock for us and
the cool thing was (and still is), the more basic the blocks were, the
more freedom they gave us. As we got older, we changed, and so did
Lego. We can still sit with our friends complaining about the dark years
of Lego when those basic building blocks turned into pre-molded pieces
of wings, buildings, animals putting a definitive stop to the creative
outlet that provided so much joy in our youth. It seems that Lego heard
our complaints and has miraculously recovered, not only financially but
also ethically (from our point of view). Back are the boxes of basic
building blocks that set your imagination free you can even buy them
by the gram nowadays shovel provided!
So what does that short story have to do with APIs? Lets see if we can
piece that together. Pun intended.
APIs are the glue that makes modern web applications work. Just like
Legos have a universal way of adhering to each other, APIs provide a
standardized and (fairly) simple way to connect data sources to each
other. By using platform-agnostic technologies like HTTP, JSON and
XML, they are the ultimate facilitators for integrating all those data
sources into innovative applications and solutions.
Ah Innovation! This is where things get really exciting. The quality of
all the APIs that are used to glue these applications together are pivotal
to their success. In this eBook, we will visit some essential concepts
around API quality, from design and testing to monitoring post-deployment performance.
API Monitoring
by SMARTBEAR
API Modeling
Grounded in the premise that the design of an API communicates how
app developers will use it and that the API is an extension of a brand,
API modeling is a critical concept and discipline.
Develop a Model
Designing API resources and representations begins with a basic understanding of domain modeling. We sometimes use theUnified Modeling
Language(UML) to create a visual model of object-oriented software systems.
However, even a low-tech napkin sketch
can help the conversation get started.
Resources, data fields, and relationship
mappings are all helpful down the road if
discussed and documented up-front.
Conceptualize
To start, gather all the stakeholders involved in the API team, including
marketing folks, business analysts, software engineers, and key business people. The goal is to build a conceptual model of the API that will
eventually be translated into working software. Include language for any
surrounding processes that might be related to this initiative: background jobs, ETL processes, etc.
API Monitoring
by SMARTBEAR
Define
Develop a common language, like a glossary of terms that will appear
in the API. Once that language is established, its important to use
these terms everywhere: in resource names, identifiers, data fields,
and documentation. This reduces confusion caused by mental contextswitching when speaking to different audiences about the API, including
app developers.
Resource
Using a common language, piece together what should be exposed via
the API. Resources should emerge naturally from conversations with domain experts. Start with top-level resources and work down the list. Take
into consideration all the near-term business projects and dont forget
that some resources may only be exposed to a few individuals with the
proper permissions.
Define Success
An API Team defines what makes their API successful. Defining acceptance criteria early ensures the API gains alignment among all business
units with a stake in the game. Criteria may be in terms of:
Developer Adoption
Server Performance
Quality Metrics
Business Revenue
Usage Metrics
Sales Leads
Write acceptance criteria with terms that are understood and valued
by all members of the API team; ubiquitous language works. This way,
criteria may be eligible for automated testing by the technical team,
which gives the team something to celebrate and acts as an outline for
communicating success to key stakeholders.
Iterate
An API represents your organization and your brand, so make sure all
stakeholders are present for key API decisions. Going solo often leads
API Monitoring
by SMARTBEAR
to a late realization that marketing doesnt use the same terminology, for
example, or the discovery of resource challenges too late in the game.
In reality, most problems in modeling are not technical in nature. When
business processes are complex, so is the API that supports them.
Continue to iterate. In most cases, a shared language reflects complex
relationships that evolve as information is gathered to further the success of your API program and the latest version of your API design.
API Monitoring
by SMARTBEAR
API Monitoring
by SMARTBEAR
API Monitoring
by SMARTBEAR
API Monitoring
by SMARTBEAR
Entry point(s)
Resource paths
Methods to access these resources (GET, POST, PUT, etc.)
Parameters that need to be supplied with these methods
(Query, Template, HTTP Header, etc.)
API Monitoring
by SMARTBEAR
10
Lets have a quick high-level look at whats out there (in alphabetical
order):
apiary.io
Apiary has created a markdown-based metadata called the API Blueprint format. The parser itself is open-source and the format is well
described on their website and on GitHub. Once you have an API Blueprint for your REST API the apiary platform can be used to generate
documentation, create server mocks, perform validation, etc. Although it
is technically possible to use the API Blueprint format itself outside the
apiary.io platform, most of the value-added functionality in the apiary.io
platform seems to be proprietary.
ioDocs
ioDocs is Masherys take on REST metadata and documentation; their
open-source (node.js based) platform uses JSON-formatted metadata to generate an interactive documentation for the described API
that can be used to both learn about an API and execute ad-hoc calls
against it. As opposed to the other standards described here, ioDocs
also includes basic support for signatures and different versions of
OAuth. As mentioned, the core ioDocs platform and tools are opensource and free to use outside the Mashery platform, but just like with
apiary.io, a large number of value adding features are made available
when using the Mashery platform to manage your APIs.
Swagger
Swagger is a REST metadata format being developed by Reverb, a spinoff from the Wordnik team. Swagger uses JSON (although it supports
XML) and JSON-Schema to describe REST APIs and their parameters
and messages. Just like ioDocs, it includes an open-sourced UI (swagger-ui, entirely in HTML/javascript) double-serving as documentation
and ad-hoc testing utility, but Swaggers strength lies in its ecosystem
available at GitHub for generating both code for a number of different
languages and Swagger definitions themselves via (for example) java
annotations.
API Monitoring
by SMARTBEAR
11
WADL
WADL (Web Application Description Language) is an XML vocabulary
that has been around for quite some time (it least in internet-time). It
was submitted to the W3C by Sun in 2009 but hasnt been standardized
on, perhaps due to lack of adoption. Technically it provides good support
of the REST concepts outlined above; its grammar mechanism allows
for the use of any standard for describing resource representations
(JSON Schema, XML Schema, etc.) and there are a number of tools out
there to generate code, tests and documentation from WADL specifications.
WSDL 2.0
You might be surprised to see this on the list, but technically both WSDL
1.1 and WSDL 2.0 support description of REST APIs (although the support is meager in WSDL 1.1). Unfortunately though, the lack of RESTfulness in WSDL and its association with SOAP will probably result in
its inclusion here being shrugged off as a curiosity as opposed to a valid
alternative. That being said, WSDL 2.0 does technically support the
description of REST APIs but its core model is not around resources/
methods/representations, and the tooling is not as extensive as for the
above-mentioned formats.
Selection Criteria
When trying to select one of these metadata formats for your API, make
sure you take the following into account:
Is it easily accessible?
Are the included tools available for your platform?
Is there relevant tooling available given your target audience
and their needs? (Testing, code generation, etc.)
API Monitoring
by SMARTBEAR
12
This is obviously just scratching the surface, but hopefully gives you an
idea of which areas to explore further.
API Monitoring
by SMARTBEAR
13
API Quality
As part of the Modeling discussion, we mentioned that you should
define Acceptance Criteria up front. This should include quality metrics
as well. Do you have service level agreements with your customers for
performance and uptime? Are there specific calls within the API that
must be bug-free in order to drive developer adoption?
When you plan your API quality strategy, you should plan on 4 types of
testing (at a minimum):
Functional Testing
Your primary validation should be focused on the functionality the API
is intended to deliver. If it is to provide a capability, then you need to
test the API calls to make sure that capability is delivered according to
API Monitoring
by SMARTBEAR
14
the model you developed with your team. If it is to retrieve data, then
validate that the correct data is returned per your model.
Security Testing
Adding security scans helps you make sure your web services are protected from vulnerabilities. With the increased focus on healthcare APIs,
government APIs, and financial services APIs, its important to discuss
your security requirements as part of the modeling session with your
team. If you have security concerns, you should include them as part of
the acceptance criteria and plan to actively test for vulnerabilities.
Load Testing
Often neglected, load testing can help you ensure that business success doesnt quickly evolve into business failure. When designing your
load tests, be sure to include all stakeholders who can influence traffic
to your application, including external developers using your APIs. If
your APIs are exposed to partners or the public, the load on your servers can be fairly difficult to predict running frequent load tests against
your APIs can help you determine your breaking point and put the appropriate monitors in place.
API Monitoring
by SMARTBEAR
15
Given that your functional API tests are set up to assert and
provide relevant error messages, the corresponding API
monitors will have the ability to give you much more detailed
error information for root cause analysis than regular availability
monitors.
Obviously, using one tool for creating tests and monitors is lower
overhead in maintenance, learning, cost, etc.
API Monitoring
by SMARTBEAR
16
for your own APIs, it makes you run your monitors with the same
access rights as your users, so you can detect problems that
might not affect super-user accounts
for 3rd party APIs, it allows you to plan billing and utilize
bandwidth separately from your production API usage
Dont overdo it
You probably dont need to monitor from every location in the world,
or exercise all operations in all your APIs with every possible input.
Instead, make sure your API monitors are a safety net for catching
API Monitoring
by SMARTBEAR
17
problems within the hot-spots of your API and those areas that are
most vital to your API business. Overdoing things will just result in poorly
maintained API monitors, which start to fail and which you will start to
ignore, which in the end wont provide any value to anyone.
API Monitoring
by SMARTBEAR
18
petitors API to guess developer portal traffic, then model the expected
developer sign-ups and conversions (for example, 10% of visitors might
ask for a key, 20% of them might built an app, 10% of those apps might
drive ongoing traffic, each of those apps might drive a certain volume of
traffic, and so on... )
API Monitoring
by SMARTBEAR
19
Community members
Community forum activity and engagement
Number of very active members
Net promoterscore
Financial (measure of business model fit)
Revenue
Cost of data served (if licensed)
Profit and margin
Market share
Its clear that APIs are a critical part of your software planning and
should get just as much attention at each stage of the lifecycle as any
other feature on your roadmap. Hopefully, the concepts here will help
you develop and measure your APIs with growth and sustainability in
mind.
API Monitoring
by SMARTBEAR
20
To Summarize
Keep your designs elegant and simple
Use modeling as a technique to ensure you are building the
right API
API Monitoring
by SMARTBEAR
21
SmartBear Software, Inc. 100 Cummings Center, Suite 234N Beverly, MA 01915
+1 978.236.7900 www.smartbear.com
2013 by SmartBear Software, Inc. Specifications subject to change.
SB-SUI-061413-WEB
About Apigee
Apigee is the leading provider of API products and technology for enterprises and developers. Hundreds of companies including AT&T, eBay,
Pearson, Gilt Groupe, and Walgreens use Apigee to reach new customers and drive innovation through APIs, apps and data. Apigees API Platformis built on enterprise bedrock and designed to meet the challenges
of the new mobile, social, cloud marketplace head-on. The API Platform
enables businesses and developers to create and deliver well designed,
scalable APIs and apps, drive developer adoption, and extract business
value from their API ecosystem. Learn more at apigee.com.