API Parameters 101
APIs are important if you want to integrate Symphona with any piece of software. But don’t worry – they don’t need to be complicated. In this tutorial, we’ll go over:
- What an API is and what they do
- Some useful terms to understand APIs
You can spend a lot of time learning about APIs. This tutorial aims to focus on the bare essentials – everything someone with no coding experience would need to know to use APIs.
We recommend reading the whole article – but if you want to get started right away with using APIs, we recommend reading the sections on what APIs are and HTTP methods.
Let’s dive in!
So…What is an API?
API stands for Application Programming Interface. APIs allow different pieces of software to communicate with each other. In order to integrate Symphona with any external tool, you’ll need to invoke that platform’s API.
Imagine you’re a customer at a restaurant. An API is like a waiter. It provides you a menu of what you can request, communicates your request to the kitchen (back-end), and returns with a response from the kitchen, which could either be what you requested, a prompt for more information, or an error.
In order to communicate with a program’s API, we have to make what’s called an API call.
For example, any website that shows the Weather Channel forecast requires that website to make an API call to the Weather Channel and request local weather data information.
Symphona can integrate with any application that has either a REST API or a CMS API. For now, don’t worry about what REST or CMS means. They’re just popular types of APIs.
Now that you know what an API is and why we need to know them, let’s go over some basic terminology and tools that will help you when invoking an API.
API Terminology and Tools
URL
URL stands for Uniform Resource Locator. They’re a subset of URIs that give the address of a unique resource on the web, like a website. You input a URL to access websites, like Google or YouTube .
When you invoke an API, you’ll need the URL of the website whose information you’re requesting.
HTTP methods / verbs
HTTP methods (or API request methods) are often called “HTTP verbs” because they represents different actions an HTTP client can perform when making an API call. They’re also standardized across the web – so these commands are the same across most software, no matter what API you’re calling.
You’ll need to use these methods for Symphona to interact with any third-party software or vice-versa.
Here’s a table of the request methods and what they do (with examples of how you could use them with software like WordPress).
Request method | Description | Possible uses in WordPress |
GET | Retrieves a resource | Get data of all of your WordPress Posts |
POST | Creates a new resource | Generate a new WordPress Post |
PUT | Edits or updates an existing resource | Edits an existing WordPress Post |
DELETE | Deletes a resource | Deletes a Post |
Note: you can learn about WordPress’s API (and APIs in general) by reading their official documentation here.
Routes and endpoints
A route is an URI that can be mapped to an HTTP method. An endpoint is a mapping of a specific HTTP method to a route.
Here’s the example WordPress gives in their documentation:
As an example, if we make a GET request to the URI http://oursite.com/wp-json/ we are returned a JSON response showing what routes are available, and what endpoints are available within each route. /wp-json/ is a route, and when that route receives a GET request, then that request is handled by the endpoint which displays what is known as the index for the WordPress REST API. The route wp-json/wp/v2/posts by contrast has a GET endpoint which returns a list of posts, but also a POST endpoint which accepts authenticated requests to create new posts.
Requests
Making an API call usually involves making a request, whether it be obtaining information, editing information, or deleting information.
Requests are handled differently by various platforms. For example, WordPress generates a Request Object whenever you make an HTTP request on a registered API route. The info in the Request Object will depend on your HTTP request.
Responses
Once you make a request, you’ll receive a response. Responses can vary based on the platform you’re calling, but examples include:
- Success: if the response succeeds, your request will be fulfilled. For example, if you made a call to WordPress through Symphona to post on your website, a success response means the request went through and Symphona successfully posted on your website.
- Failure: if the response fails, your request was denied. There could be multiple reasons, such as:
- Need more information: some APIs will require more information from you before they can fulfill your request
- Need authentication credentials: many APIs won’t let you make a request until you provide your login credentials to their platform.
With this information, you should have enough to get started calling APIs and integrating your tools and software with Symphona!
If you want to see in-depth guides on how to do this, we have tutorials on how to integrate Symphona with over 20 popular software platforms. Since we’ve talked about WordPress so much, try checking out our WordPress integration tutorial here.