Home Insights What is a web API?
8th January 2023 in News

What is a web API?

By Dorota Lewinska

What is a web API?

Many businesses have a WordPress website and sometimes it is important to the business to integrate their website with third party services that have an web API. For example bulk email (newsletter) processing systems, data analysing systems, event booking systems to improve the efficiency and functionality of their business.  

Integrating with Third-Party Services 

Every third-party Application Programming Interface (API) service requires the user to register and assign access to an administrative web panel where they manage their account and set up the service. Sometimes WordPress integrations allow for most of that to be done in the dashboard, but usually the user needs to access the service directly and manage it there.  

It’s also worth noting that multiple services can be used by a single WordPress site, so things can get very complicated and hard to manage without good planning and preparation.  

What is a web API and how does it work? 

In simple terms, an API is a way for two systems to exchange information via the internet. However, two machines talking to one another works differently than two people talking. For two machines to understand each other, there are parameters of the conversation that must be followed. Only certain questions are allowed, and answers will always follow the same pattern.  

A good analogy is a phone answering machine that accepts options. Let’s say you are trying to top up the credit on your phone. You call the number and receive the following options: “If you want to top up the number you are calling from press 1, if not press 2.” You can then choose your option and hear another prompt with another set of options. Note that if you press any other number than 1 or 2, the machine will identify an incorrect input and will most likely repeat the available options.  

So a Web API is very similar – it offers a set of questions/commands that can be asked/requested and answered/executed. These can return information or perform a task. This means that the things you can do in WordPress with your third-party service is limited to what their API offers.  

In most cases, APIs allow most of the operations available in the service provider’s web panel but occasionally there are limitations. Before you subscribe to a service and start the project, it’s always worth checking the scope of the work and how robust a third-party API is. This will  to avoid any issues where it is not possible to setup client required functionality, and disappointment further down the line.  

All companies offering a web API will have online documentation listing the list of questions and answers that they allow.  

When is a web API required?  

Within a WordPress environment, the many integrations are setup by adding plugins to the site. Plugins are available in the WordPress plugin repository that supports most popular services, such as MailChimp, Google and social media platforms making them quick and easy to install.  

There are other services that can also be used, such as Zapier, to connect to multiple services from forms or ecommerce services.

However, some smaller service providers do not have a WordPress plugin or Zapier integration and so if a user wishes to integrate the service with their WordPress site, they will need a web developer to write a custom plugin.  

Example for the Remote Lock API

A recent case study from a client project – WordPress site integration with service provider Remote Lock. Remote Lock supply and manage digital locks, allowing PIN pad access to buildings and rooms. 

Our objective was to develop the website booking system so that each person booking a room was sent a PIN generated by Remote Lock to access the room at the time of booking. 

For example, in our case, you can view Remote Lock documentation here https://connect.lockstate.com/api/docs . Even a quick glance at the site index tells us that they offer a lot of options – when we worked on this project, we only used about half.  

How our web developer created a custom plugin to work with Remote Lock?  

The first step is to give system access to your web development team – for the build and testing process it is best to use the API in testing mode. Unfortunately, not all APIs offer this option, a back-up to this would be to use test data and settings, you may need the help of the API provider to set this up.

In our case with Remote Lock we set up a test lock during the development stage. Once the plugin was built, we switched over to the customer’s lock for the final tests and fine-tuning.  

All API integration plugins require credentials to connect to the API – these are available in the service provider’s web panel in the form of private and public keys and some services require the user to regenerate them from time to time, others don’t.  After saving these credentials in the plugin, the API connection should work and data between WordPress and the service of your choice should be freely exchanged.  

In our case, the bookings made on the website are sent to the system that manages the lock, and in return it receives an access PIN number for the lock, so that visitors can enter at the allocated time. 

Results for this project 

In the first six months after launch there were many hundreds of bookings using the website calendar and Remote Lock integration. 

We really did land lucky with Indigo Tree. Having never used their services previously I was extremely pleased at their level of professionalism, creativity, communication at key stages of the project, and of course, the end product. I would not hesitate to recommend their services. 

Andrew Bontoft, Sensory Cave 

So if you have a WordPress website and would like to integrate it with your business systems, get in touch and we will be happy to advise on the best approach to take!