Beginners Guide to Web APIs
August 11, 2020Web API – these days, it’s a term that startups throw around all the time. Whether it’s machine learning, photo editing, taking credit card payments, or creating Sniply links, there’s an API for that. But what does Web API actually mean? And why should you even care what it means?
Web API For Beginners
The acronym API actually stands for “Application Programming Interface”, but it basically just means that it’s a way that an external programmer can interact with a piece of software without caring about the inside implementation details. Understanding APIs and how they work is a powerful skill for web development and application creation because you can build on top of software to make something that performs some advanced functionality without writing major libraries of code.
It’s like when you drive your car: you can turn the steering wheel, step on the gas, or slam it into reverse but (unless you’re an automotive engineer) you don’t really know (or care) how it works on the inside. This means that you can ignore a lot of the complexity that happens inside the car and just enjoy the drive. In the same way, a software developer can use an API to get all of the functionality of a piece of software without having to look at all of the internal complexities of a problem, even if they are a beginner with only a rudimentary understanding of API basics. Now you can begin to see why people are so eager to learn how to use APIs to harness everything internet APIs have to offer.
APIs are particularly popular online, where programmers can access functionality over the internet. Web APIs are even more powerful than a simple API that runs on a single machine (like the API to a library of code) because all of a sudden, you can have thousands of computers doing calculations the instant that an API call gets made. For example, you can access the 76 million GB (ie. 76 PB) stored in Youtube’s database annually through their web API. This is exactly what we did when we developed covr.fm, one of our side projects – feel free to check it out if you like cover music 😉
A Basic Guide to Sniply’s Web API
Online APIs work by providing a set of URLs to developers where they can send data to a website’s servers. The servers accept the data, perform any necessary calculations and data crunching, and provide a response to the web developer. For example, using the Sniply API, you can automatically create customizable Sniply links without having to manually click through the Sniply creator over and over again. This is really handy in two cases: when you are creating a large number of links or when you are creating links on behalf of someone else. If you would like to create something similar to Sniply to share your message (or your users’ messages), using the Sniply API will allow you to access all of the power of Sniply in as little as a single line of code. In fact, I’ll even write the Pythonic code for accessing Sniply’s API right here:
sniply_link = requests.post(
"http://snip.ly/api/snips/",
data = {
"url":"snip.ly",
"message":"Sniply is the best!"
},
headers = {
"Authorization":"Bearer my_access_token"
}
)
If you run that code with a valid access token, you will create a Sniply link that looks just like this one! Cool right? It’s really simple and I’d gladly walk you through the basic steps to integrate Sniply into your app or workflow. To get access to the API or to experience a quick Sniply API tutorial for beginners, send me an email at [email protected] and I would be happy to get you started developing something awesome! If you would like to take a peek at our supporting documentation, you can look at the technical information at https://snip.ly/api/v2/.