Which came first, APIs or DevOps? Though the two are complementary, the answer here is clear. There are major benefits of DevOps in your API lifecycle, but APIs are likely responsible for the growth in DevOps methodologies. The Cloud, modern code reviews, and continuous integration all depend on APIs.
APIs Cause Cloud Formations
Plenty has been written about how cloud computing changed the Internet. Companies who adopt the cloud are free of operating their own hardware. That has two benefits: they can focus on their strengths and they can scale faster than their own data centers. Scaling requires automation, which requires APIs.
Famously, Amazon required developer interfaces for all its projects. That mandate may have ushered the way for cloud APIs. AWS has a laundry list of APIs for its many cloud services. Google, Azure, and every AWS competitor has similarly lengthy developer offerings.
Automation does not require APIs, but it’s hard to imagine modern development without the scripts to deploy, expand, and contract various cloud hosting tools.
APIs Trigger Code Reviews
Before code can be deployed, many engineering teams have review processes. Source control, project management, and other tooling need to communicate status. APIs drive much of this conversation, with the aim to automate the review workflow.
GitHub and GitLab are hosted version control systems that enable code lifecycle tools. Both are based on the widely-used Git system, but have built software around it to enable dev teams to communicate. For example, when code is ready for review, GitHub users submit a “pull request” to have another engineer review their code.
The GitHub API allows for systems to subscribe to notifications via webhooks for various events, including several related to pull requests. DevOps workflows can be alerted when code needs to be reviewed, requires edits, or has other changes in status.
Hosted version control systems maintain much of the team conversation, but often need to connect the status to other systems through webhooks and APIs. You could receive notifications via email, in Slack, or other chat apps. You might automatically update your project management software or trigger any number of internal tools. The potential destinations can expand rapidly when it’s time to deploy the reviewed code.
APIs Activate Continuous Deployment
The servers have been orchestrated, the code has been written and reviewed. Next comes a common element of DevOps practices: continuous integration and deployment. As code is merged into the source control’s primary branch, it can be automatically tested and deployed. How much of this is automated varies by teams, but APIs drive the communications.
In fact, APIs and webhooks play a big role in customizing a DevOps workflow. The BitBucket to Jenkins diagram above shows one engineer’s middleware to prepare a Jenkins pipeline. You might additionally have Jenkins (or another DevOps tool) call out to other services or your own code based upon events within each build.
In the same way that internal teams count on APIs, anyone practicing DevOps needs public and private interfaces to connect everything together.