Harnessing third-party APIs: advanced WordPress strategies on Kinsta

Third party APIs on Kinsta

WordPress is a powerful content management system (CMS) complete with a mammoth ecosystem of themes and plugins. This gives you an almost unlimited number of ways to expand your site’s functionality. However, “almost” is the keyword here. For those times when you want to extend your site’s capabilities in a different way, third-party APIs will be the answer.

In this article, we’ll explore the benefits of using third-party APIs with WordPress. Throughout, the post will look at the different types of APIs available, tips for choosing something suitable, and more. The main part of the post will explore how to use third-party APIs with a Kinsta-hosted WordPress website.

There’s a lot to get through, so let’s begin!

What third-party APIs are

An Application Programming Interface (API) is a set of rules and protocols to let different apps communicate and interact. APIs are intermediaries as they enable you to access specific data from external services.

Once you have access to the data available, you can bring it into your own applications. The typical approach is to use an appropriate language, such as cURL, JavaScript, Python, or PHP.

A detailed view of Node.js code displaying how to read an unoptimized JPEG file using the filesystem module, and optimize it using TinyPNG's Tinify API.
A snippet of code from TinyPNG’s Tinify API.

WordPress offers first-party APIs, such as the REST API. These expose ‘endpoints’ in the core code to let developers ‘hook’ into it. This often gives you more scope and flexibility than using a plugin.

Of course, Kinsta also provides a REST API to connect and work with its platform away from the MyKinsta dashboard. This will let you achieve tasks such as retrieving server logs, setting up websites, and more.

When you use a platform’s API to access its endpoints, this is first-party. In contrast, using an API from one service within another makes it third-party. For example, you might access the endpoints for the OpenWeatherMap’s Weather API within your WordPress site’s code.

The OpenWeather site detailing its Weather API, specifically the One Call API 3.0. It mentions the API's capability for historical weather data and daily aggregation, alongside subscription details including a free tier and a ‘pay as you call’ pricing model.
The OpenWeather Weather API page.

As you can expect, this can open up the scope of what you can achieve with WordPress, Kinsta, and your site.