Exploring the Basics of API Integration

What is an API and why use them? 

An API or Application Programming Interface to use the full name, is a piece of software that allows one system to talk to another, in a structured format. It works by using a pre-defined set of standard programming language calls to enable each system to communicate.

To better understand the concept of API’s it can be thought of a translator between 2 different languages. If your only speak English but need to communicate with someone who only speaks French, you need someone / something in the middle to translate who understands both languages and provide a conduit to enable communication between the systems. The translator is in essence your API.

Why are APIs important? 

APIs are the sets of rules and protocols that enable different systems to communicate with each other, making APIs an integral element in allowing your software developers to connect your disparate applications.

Why is it so important to enable your systems to communicate effectively?

In most businesses there is an array of business-critical systems to address all the unique requirements of running a growing business. From a contact management system, ERP system to your accounting package, through to your communication systems, ensuring all the data is accessible to not only the relevant systems that require access to that data, but your staff / users to access the data in a single access point creating a single source of truth for all your data.

API’s are the gateway for example to ensure the data entered into your communications system is integrated and available in your CRM solution to allow you to track communications between your sales team and a potential client, or the data for your invoices are automatically updated in your accounting system preventing duplication of data and removing potential errors in entering the data.

Different kinds of APIs 

As you can imagine, there are a wide variety of APIs in existence, with new ones are showing up every day. Developers often make their own API’s to link systems together, connecting a bespoke Business Information System with Sage for example.

There are different kinds of APIs, which whilst doing the same job, do work in different ways.

  • REST APIs
    • If your app relies on data from a 3rd party online service, you are likely to have used REST (Representational State Transfer) APIs. This is by far the most common way of implementing APIs on the web. A REST API is based on the HTTP protocol and uses requests to POST (create), PUT (update), GET (read), and DELETE data. These APIs are often accessed over a simple URL like https://example.com/api/users and applications can interact with this API by making HTTP requests to this URL endpoint.
    • The REST APIs generally communicate with JSON data. There is no specification which requires the request/response data to be in JSON but it has evolved as such as JSON can easily be parsed in almost any language.
  • SOAP APIs
    • SOAP APIs are another type of web API. They use a protocol called SOAP (Simple Object Access Protocol) to send and receive data. SOAP is an XML-based protocol, which means it uses a specific format for the messages that are sent back and forth between the client and the server.
    • SOAP APIs are typically used for more complex, enterprise-level applications, and they often require more setup and configuration than REST APIs. They can be a bit trickier to work with than REST because the messages are in XML format, which can be more difficult to parse and understand.
  • Operating System APIs
    • As the name suggests, rather than connecting two systems to share information, these operating system APIs facilitate communication between a process and the underlying hardware.
    • For example, if you are writing a program that needs to access a file on your computer’s hard drive, rather than writing code that directly interacts with the hard drive, you can use the operating system’s API to perform file operations without worrying about the details of how the hard drive works.
  • Database APIs
    • Database APIs allow you to access a database and the information within it without knowing the specifics of how the database works. This is how you can access and manipulate the same database from different programming languages like Claris FileMaker Pro and Microsoft SQL (MSSQL). The database is not re-implemented in all these different languages but rather it exposes an API with some instructions on how to communicate with it.
    • A database API usually exposes all the operations you might be able to do natively on the database. This involves adding, deleting, updating, and reading database records.

What is an API integration? 

An API integration means connecting two or more applications. When you see web app developers advertising about their ability to connect and communicate with other applications / websites they are doing so via API integrations.

An example of this might be how you can receive a Microsoft Teams message whenever someone creates a new task in Asana. Asana has integrated with the Microsoft Teams API and they create a new message whenever a new task is raised.

How do APIs work? 

Let’s focus on REST APIs as these are the most common kind of APIs that you will probably encounter. An important thing to note is that REST is an architecture and not a protocol or a standard. There are different ways developers can implement REST APIs. The actual request-response cycle of the REST API will differ depending on which language and web framework you use to implement it. However, the general cycle will look something like this:

  1. Request: The client sends a request to the server using an HTTP method. The request includes information about what the client wants to do, such as retrieve data, create a new resource, or update an existing one.
  2. Routing: The server’s REST API framework receives the request and maps it to a specific endpoint. The endpoint is a URL that corresponds to a specific resource or action on the server.
  3. Processing: The server performs the requested action and generates a response. The response includes information about the result of the operation, such as data, status codes, and headers.
  4. Response: The server sends the response back to the client. The response includes information about the result of the operation, as well as any data that the client requested.
  5. Processing: The client receives the response and processes it. Depending on the nature of the request and the response, the client may take additional action, such as displaying the data to the user or making another request to the server.

There are four main types of requests in REST APIs. These types are based on the pre-existing HTTP verbs:

  1. GET: Used to retrieve information from the server. A GET request should not modify the state of the server and is typically used to retrieve a representation of a resource.
  2. POST: Used to send information to the server. A POST request is typically used to create a new resource or update an existing one.
  3. PUT: Used to update an existing resource. A PUT request should completely replace the current representation of a resource with the one specified in the request.
  4. DELETE: Used to delete a resource. A DELETE request should remove the specified resource from the server.

Using APIs in the real world 

Many popular APIs are used by developers every single day. One we all know is the Google Maps embed API. Whenever you see Google maps embedded in a website, the developers have used this API in the background to do so.

Another API you see regularly is the Recaptcha API. This is what shows up whenever you are browsing the internet, the website asks you to prove you are a human.

Here at Compass Data we use APIs, both publicly available ones like those above or client specific one to connect our bespoke systems with Sage, courier shipment systems such as LinnWorks, payment systems like Stripe and many more to build easy to use business systems for our clients. Check out these examples:

Automotive distributor

Manufacturer

 

Conclusion 

In this article you learned about APIs; what they are and how the different kinds of APIs differ from each other.

Contact us to learn more, we’d love to help.

Menu