Exposing Rich Update Operations via REST APIs

Name
Michael Ngugi Michuki
Abstract
In the past few years Representational State Transfer (REST) has emerged a leader of modern Application Programming Interface (API) design for its simplicity and versatility. This has facilitated APIs with URLs that make use of HTTP methods like GET, POST, PUT and DELETE. It has also led to producing intuitive models for client developers. However, there are two issues that REST doesn’t solve alone, the first issue being standardized responses. Most enterprises have their own custom APIs, usually a JSON response that maps clearly to their custom data model. A good example is when a Twitter API client is not able directly communicate with a Reddit API and vice versa. This leads to numerous API clients that do almost, but not quite the same thing. Hence we find numerous developers duplicating the same efforts. The second issue is linking. As put by the World Wide Web Consortium (W3C): JSON doesn’t include built-in support for hyperlinks, which fundamentally constitutes as a building block on the Web. Hence the drawbacks of the two is that the API endpoints are only linked by API documentation, thus users are forced to peruse through pages of API documentation to comprehend the relationships between the API endpoints and understand what actions are required to interact with a given resource. In summary, we find that in modern day applications, the APIs developed have their update operations mapped to methods that directly manipulate the domain. In this research we discuss the underlying problem with update queries and unearth ways to enhance them for richer update methods and queries using various approaches. The first contribution in this research is to take a hypermedia format namely Collection +JSON, and to enhance it to accommodate and expose multiple update commands and templates through a single REST update method dynamically, both in the API and the client. In simple words, we reconcile the simplicity of REST, with the ample concepts of Domain Driven Development and Command Query Responsibility Segregation (CQRS). We also implement an annotation based resource assembler that generates commands dynamically by using a generic controller and interface that reduces the implementation needed to inject domain service methods into the API.
Graduation Thesis language
English
Graduation Thesis type
Master - Software Engineering
Supervisor(s)
Luciano Garcia Bañuelos
Defence year
2017
 
PDF Extras