How To Call an API With Low-Code (Or No Code at All) Using Pixiebrix
Learning how to call an API with a low-code platform is a bit like a superpower; you'll be shocked just how much you can do. Here's how it's done.
Maybe you first heard the acronym in a meeting with a developer. Or maybe you’re trying to teach yourself some basic coding skills. Either way, you’re trying to figure out what an “API” is, and how API calls have anything to do with building apps. After all, didn’t dial-up end decades ago?
Let’s dive into APIs, how API calls work, and the huge impact this simple technology can have on everything you do online.
What is an API?
An API or Application Programming Interface is a way for one application to connect to another application using a predefined set of commands. APIs provide a common structure and set of documentation that defines their behavior, which makes them nice for application developers to work with.
Today, most software either relies on APIs, or is itself an API. As APIs continue to grow in popularity, API marketplaces have emerged to streamline discovery and adoption. One of these, RapidAPI, offers over 30,000 APIs!
What is an API call?
An API is a layer of structure and documentation that allows applications to communicate with each other. Often, an API is a foundation for integration software and platforms that need to pull data from other sources. So if applications access APIs to do things, think of an API call meaning as the process of making that access.
Remember the pre-Amazon days, when you had to call a store to see if they had something in stock before you made your way over there? Think of the employee you’re talking to as the API, and the phone call you’re making as the API call.
This relationship between APIs and applications is behind a ton of the online experience you take for granted. So let’s dive into how you can use PixieBrix to call APIs and do all sorts of things.
How PixieBrix calls APIs automatically
API calls power a ton of mods on the PixieBrix marketplace — pre-built enhancements that make your online life smoother and automate manual work.
Often, these mods essentially give you a simple interface you can use to pull data from an API without any coding experience. This means you can do things you’d usually have to hire a developer for all on your own. Here are a few mods that show you how PixieBrix can call APIs for you.
OCR Translation Context Menu
This mod automatically translates text from an image into any language by using open-source APIs with built-in translation data. That means every time you use this mod, PixieBrix calls translation APIs to give you your translated text.
Get shipping rates from Shipstation
Whether you run a dropshipping business, sell merch online, or even run a brick-and-mortar business, you need to know how much it’ll cost to ship your products. This PixieBrix mod automatically pulls data from Shipstation’s API to tell you exactly that. All you have to do? Highlight an address anywhere on the web.
Pokémon usage search
It might seem like a silly example, but Pokémon can teach you a lot about calling APIs. With this PixieBrix mod, you can automatically search up metagame data on any pokemon. APIs aren’t just for work; you can do a ton of fun things with them, too!
Now that you know how PixieBrix mod call APIs to power all sorts of workflows, let’s dive into how you can create your own PixieBrix enhancements with any API.
How PixieBrix users leverage APIs
PixieBrix users can combine APIs with Bricks for richer functionality. This increases the amount of data users can access on demand, the types of operations that can be performed, and the variety of workflows that can be automated.
Here are just a few examples of how users are enriching PixieBrix with APIs:
Computer Vision:
A SafetyTech team uses PixieBrix to send license plate pictures to an Optical Character Recognition (OCR) API. The API takes the image file as an input and returns the plate number. This is faster and more reliable than visually scanning images, which are often dark or grainy.
Calculators:
A banking compliance team uses PixieBrix to send transaction data to a currency conversion API. Using PixieBrix to send data directly from their portal rather than relying on copy and paste into a separate application improves calculation speed and consistency.
Robotic Process Automation:
PixieBrix integrates with RPA platforms so users can interact with bots and apps for more seamless attended automation. For examples of specific use cases, take a look at our UiPath and Automation Anywhere YouTube playlists.
How to create your own enhancements with PixieBrix and API calls
Don’t worry, you don’t need extensive coding knowledge to learn how to call an API with PixieBrix. All you need is this step-by-step guide, a bit of pre-written code, and an API. Let’s dive in.
Step 1: Find the API you want to call
Before figuring out how PixieBrix can call an API, you need to pick your API. If you already have one in mind, then you’re ready to start! Otherwise, let’s look at some inspiration.
You can find tons of free APIs online, and this GitHub project is a great place to start looking.
You’ll find an API for everything from translation to crypto stats to a database full of cat photos. For this example, let’s pick the Ergast F1 API, which has a bunch of F1 data we can use to build an enhancement that searches up F1 data from anywhere on the web.
Step 2: Create a new Quick Bar mod
Go to any page that has the name of at least one F1 driver to start building your mod — that way, you can test it as you build. Hit F12 to bring up the PixieBrix sidebar, click Add, then Quick Bar.
Then, in the Name field, we’ll add “Formula 1 Driver Information.” In the Action Title, add “Find Driver Information.” Finally, click the All URLs shortcut in the Sites field.
Note that, depending on the enhancement you’re building, you might add a button, a trigger, or a sidebar panel instead.
Step 3: Add the “Show a modal or sidebar form” brick
This brick will give you the interface you’ll interact with whenever you need to look up F1 driver data, asking you to put in the year you want stats for.
Make sure to add the following text to these fields:
- Form Title: What year?
- Name: year
- Label: Year driver raced
- Input Type: Single-line text
Step 4: Add the “HTTP Request” brick
This is the step where your PixieBrix mod will actually call the API you picked. For this example, we’ll be using the Formula 1 API from ergast.com.
All you need to do is add the brick, and add this URL:
https://ergast.com/api/f1/{{@form.year | default("2022", true)}}/drivers.json
Note that, for this API, we’ve add an extra bit of code to make it work: {{@form.year | default("2022", true)}}
. Depending on the API you’re using, you might have to create a bit of code too, depending on what you need to pass it.
Step 5: Customize your mod
Once you’ve picked the API you want to use and added the “HTTP Request” brick, all that’s left to do is determine what your mod should do with that information. But, at this point, the API call portion of your brick is done! To make this F1 driver mod more useful, you might add to add the following bricks after your API call:
With these bricks, you can build an enhancement that automatically pulls data on any F1 driver and displays it in a sidebar. Here’s what that looks like in action.
Who’s calling?
API calls are at the core of tons of online services you rely on every day. They pull data from specific places on the web and feed it to apps, tools, and other services. With PixieBrix, you don’t have to learn how to make API calls from scratch; just use low-code, premade bricks and you can build apps that use all sorts of APIs.
Want to know what the PixieBrix community is building? Come to our Slack Community, where you can ask questions, share what you’re building, and just hang out with like-minded builders.