Introduction to APIs
What is an API?
API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other.
Application Programming Interfaces hide complexity from developers, extend systems to partners, organise code and make components reusable.
APIs are sometimes thought of as contracts, with documentation that represents an agreement between parties: if one party sends a remote request structured a particular way, this is how the second party’s software will respond.
Brief history
APIs emerged in the early days of computing, well before the personal computer. At the time, an API was typically used as a library for operating systems. The API was almost always local to the systems on which it operated, although it sometimes passed messages between mainframes.
After nearly 30 years, APIs broke out of their local environments. By the early 2000s, they were becoming an important technology for the remote integration of data.
Advantages of APIs
APIs let a product/service communicate with other products/services without having to know how they are implemented. This can simplify app development, saving time and money.
- Since APIs simplify how developers integrate new application components into an existing architecture, they help business and IT teams collaborate
- When designing new tools and products (or managing existing ones), APIs give flexibility and provide opportunities for innovation
- They also simplify design, administration and use
- APIs have become so valuable that they comprise a large part of many business’ revenue. Major companies like Google, eBay, Salesforce.com, Amazon, and Expedia are just a few of the companies that make money from their APIs. The ‘API economy’ refers to this marketplace of APIs
How do APIs work?
- APIs are a simplified way to connect infrastructure through cloud-native app development, but they also allow data to be shared with customers and other external users
- When you use an application on a mobile phone, the application connects to the internet and sends data to a server
- The server then retrieves that data, interprets it, performs the necessary actions and sends it back to your phone
- Your phone’s data is never fully exposed to the server, and likewise the server is never fully exposed to your phone. Instead, each communicates with small packets of data, sharing only what is necessary
- The application then interprets that data and presents you with the information you wanted in a readable way. This is what an API is – all of this happens via API
Real-life API example
- When you search flights online, you have a variety of options to choose from, including different cities, and departure and return dates
- Once you’ve made your choices, in order to book your flight, you interact with the airline’s website to access their database and see if any seats are available on those dates and what the costs might be
- However, you may not be using the airline’s website. You may be using a channel that has direct access to the information, for example, online travel service Expedia, which aggregates information from a number of airline databases
- The travel service, in this case, interacts with the airline’s API. The API is the interface that can be asked by that online travel service to get information from the airline’s database to book seats and baggage options
- The API then takes the airline’s response to your request and delivers it right back to the online travel service, which then shows the most updated, relevant information
API use case
Example scenario: your small business’ website has a form used to sign clients up for appointments. You want to give clients the ability to automatically create a Google calendar event with the details for that appointment.
API use: the idea is to have your website’s server talk directly to Google’s server with a request to create an event with the given details. The server then receives Google’s response, processes it, and sends back relevant information to the browser, such as a confirmation message to the user. Alternatively, the browser can often send an API request directly to Google’s server, bypassing your server.
How is this Google Calendar’s API different from the API of any other remote server out there? In technical terms, the difference is the format of the request and the response. To render the whole webpage, your browser expects a response in HTML that contains presentational code, while Google Calendar’s API call would just return the data (likely in a format like JSON). If your website’s server is making the API request, then your website’s server is the client (similar to your browser being the client when you use it to navigate to a website). From your users’ perspective, APIs allow them to complete the action without leaving your website.
Approaches to API release policies
- Private: the API is only for use internally. This gives companies the most control over their API.
- Partner: the API is shared with specific business partners. This can provide additional revenue streams without compromising quality.
- Public: the API is available to everyone. This allows third-parties to develop apps that interact with your API and can be a source for innovation.
Public APIs and API integration
APIs are a longstanding concept in computer programming and they have been part of developers’ toolsets for years. Traditionally, APIs were used to connect code components running on the same machine. With the rise of ubiquitous networking, more and more public APIs (sometimes called open APIs) have become available.
Public APIs are outward facing and accessible over the internet, allowing you to write code that interacts with other vendors’ code online; this process is known as API integration. These kinds of code mashups allow users to mix and match functionality from different vendors on their own systems. For instance, if you use the marketing automation software Marketo, you can sync your data there with Salesforce CRM functionality.
‘Open’ or ‘public’ should not be interpreted as meaning ‘free of charge’ in this context. You still need to be a Marketo and Salesforce customer for this to work. However, the availability of these APIs makes integration a much simpler process than it otherwise would be.
Remote APIs
Remote APIs are designed to interact through a communications network. By ‘remote’, this means that the resources being manipulated by the API are somewhere outside the computer making the request.
Since the most widely used communications network is the internet, most APIs are designed based on web standards. Not all remote APIs are web APIs, but it’s fair to assume that web APIs are remote.
Web APIs typically use HTTP for request messages and provide a definition of the structure of response messages. These response messages usually take the form of an XML or JSON file. Both XML and JSON are preferred formats because they present data in a way that’s easy for other apps to manipulate.
The modern API
Over the years, what an ‘API’ is has often described any sort of generic connectivity interface to an application. However, more recently, the modern API has taken on some characteristics that make them valuable and useful:
- Modern APIs adhere to standards (typically HTTP and REST) that are developer-friendly, easily accessible and understood broadly
- They are treated more like products than code. They are designed for consumption by specific audiences (for example, mobile developers)
- Modern APIs are documented, and they are versioned in a way that users can have certain expectations of their maintenance and lifecycle
- Since they are much more standardised, they have a much stronger discipline for security and governance
- The modern API has its own software development lifecycle (SDLC) of designing, testing, building, managing and versioning
Sources
- https://www.mulesoft.com/resources/api/what-is-an-api#
- https://www.freecodecamp.org/news/what-is-an-api-in-english-please-b880a3214a82/
- https://www.infoworld.com/article/3269878/what-is-an-api-application-programming-interfaces-explained.html
- https://www.redhat.com/en/topics/api/what-are-application-programming-interfaces
- https://www.howtogeek.com/343877/what-is-an-api/
Marketing & Communications Director at Blockstream
3 年Thanks for sharing this, interesting point!
Founder & CEO at KEDIANOMICS
3 年Excellent!
The Transformer | 4x Author, "Do What You Want" | Advisor to CEOs and Wall Street pros
3 年Thanks for sharing Kristen!
Merchant services for Business Consultants , Coaches, and Small Business Owners
3 年What a great post Kristen!
Corporate Media| Public Relations| Strategy| Branding|Management consulting. A global perspective and ambition to transform the future with the right innovation and communication.
3 年Well said Kristen - thx for sharing this post!