API commons

REST Tooling

In section 6.3 of Roy’s dissertation, he explains how REST applies to HTTP.   But the implementing a RESTful approach requires painstaking assembly without REST tooling.   Java JAX-RS and API Management infrastructure reduce the learning curve, increase API adoption and decrease development effort by simplifying API creation, publication, and consumption.

The Java API for RESTful Web Services: JAX-RS

JSR 311, JAX-RS, is Java’s RESTful programming model.   In JAX-RS, a single class corresponds to a resource.   Java annotations are used to specify URI mappings, mime type information, and representation meta-data conforming with REST constraints (see Table 1).

 

Table 1. Mapping REST concepts to JAX-RS

REST concept JAX-RS Annotation or class Examples
Addressability @Path and URI Path Template @Path(“/user/{username}”)
Uniform Interface @GET, @PUT, @POST, @DELETE, @HEAD @GET@Produces(“application/json”)public String getUser(String username) { return getUserService(username)); }
Self-descriptive messages @Produces, @Consumes @Produces({“application/xml”, application/json”})
HATEOAS UriBuilder UriBuilder.fromUri(“http://localhost/”).   path(“{a}”). queryParam(“name”, “{value}”). build(“segment”, “value”);

 

WSO2 Application Server relies on Apache CXF to process JAX-RS annotations and expose a RESTful API.   Your existing Apache CXF code can be readily migrated to WSO2 Application Server.

API Management

RESTful APIs may be either naked or managed.  A naked API is not wrapped in security, subscription, usage tracking, and service level management.  A managed API increases reliability, availability, security, and operational visibility.   By placing an API gateway in front of your naked RESTful API or service, you can easily gain advanced capabilities (see Figure 1).

api capabilities Figure 1: API Management Capabilities and Topology

 

The API gateway systematizes the API façade pattern, and enforces authorization, quality of service compliance, and usage monitoring without requiring any back-end API modifications.   Figure 2 demonstrates API facade actions commonly provided by industry leading API gateway products.

api-pipeline Figure 2: API Façade Operations

 

WSO2 API Manager can easily integrate with your RESTful system and rapidly add advanced capabilities.  For more information on API management, read the technical evaluation guide