API Chaining

API Chaining is a pattern using an I/O monad enabling a client to send multiple API calls each having a natural relationship to each other within the confines of a single HTTP request. Each API call is sent with required method (ie GET,PUT,POST,DELETE) but only one 'UNSAFE METHOD' can be declared for the entire chain (usually at the beginning or end of the chain).
EX. GET > GET > GET > PUT
EX. POST > GET > GET
In existing implementations, this is built using a HandlerInterceptor (or 'filter' in the case of Rails) so the initial REQUEST data isn't lost on the chained API calls and chained API calls can be passed through the prehandler/posthandler without going out and coming back in to the application thus saving processing and time. This enables all API calls to stay within the confines of one request.
This is not to be confused with 'method chaining' where the client does not send state and all handling occurs on the server side. Method Chaining differs in that state is not sent and chain cannot be set through the client and is set by the application; the functionality is hardcoded server side and cannot be created by the client like a traditional API call.Also due to lack of a perHandler/postHandler for the request/response, 'forwarding' often needs to create a new request thus leaving and coming back into the application creating additional overhead with each call.
This also should not be confused with 'SOAP on a Rope'; This is an attempt to implement method chaining with a SOAP call but is still method chaining as it does not send state with each link in api chain.
History
Created in the fall of 2013 as part of the copyrighted work, the, Grails API Toolkit it was released in January 2014. The pattern was later presented that same year at APIDays Berlin and SpringOne 2GX. Early adoption has initially been slow but there has been great interest in the methodology for the architectural problems it solves. Interest from companies like Mashery, Apple, Paypal has already brought significant notice to the methodologies.
Currently, this functionality is being added extended to Node.js and spring-boot with other frameworks and toolkits in the works.
 
< Prev   Next >