Lob is an API company. That means that our external product offerings are all APIs and all our internal tools are also APIs. We believe that an API-first approach to development improves our code quality and empowers our developers.
What is API-First Development?
The idea that a piece of shared functionality for your organization should be exposed as a RESTful HTTP API to your developers. Rather than creating a library or module, developers can consume the necessary functionality via API. Having developers consume all functionality through an API enforces separation of concerns and hides internal complexity.
Enforcing Separation of Concerns
One of the most basic examples is decoupling the front and back ends of a web application. In this case an API is created to house the business logic and data access (the back end). It is only responsible for communicating through a RESTful interface with the front end. This makes it much easier for developers to create consumer facing APIs using the same back end.
At Lob, we believe taking this separation even further makes it easier for our developers to quickly create high quality applications. The example below demonstrates how independent APIs accessible over a RESTful interface contain the internal functionality for billing, accounts, and shipping.
Consequently our team has a well-documented interface when building a new product offering involving billing, shipping, or accounts.
Providing functionality via RESTful API allows developers to abstract that functionality away from the developers consuming the API. Consuming developers only need to know about endpoints, responses, and errors which can all easily be handled with quality documentation.
If I am the developer in charge of the billing functionality, here is just a sampling of the features I need to worry about:
- Multiple payment platforms (Stripe, Balanced, BrainTree, BitCoin, etc.)
- Payment Cycles (recurring subscriptions, one time charges, etc.)
- Issuing refunds and tracking credits
- Following up on unpaid bills and expired credit cards
However, if I am the developer I am only concerned about things such as charge customer A $50 on June 12 or bill customer B $200 at the beginning of each month for the next year. I’m not concerned about which payment provider is used, whether the customer has credits, or following up to obtain a valid credit card. Internal functionality through RESTful APIs allows developers to focus their energy on just their product.
At Lob, we believe that APIs are the future for how businesses will communicate with one another. Enforcing this type of communication between our internal teams allows us to develop efficiently and to learn what works. This has been a great learning experience for the team thus far. We have learned what tools allow us to be the most efficient and which ones hinder efficiency. The biggest challenges we have faced have been identifying how to test API endpoints and how to version breaking changes in an API.
If you have any thoughts on the use of RESTful APIs for internal functionality, the biggest challenges when developing APIs, or tools/techniques that you rely on for API development, we would love to hear about them!