top of page
  • Writer's pictureTim Buchalka

What Is an API and How Is an API Used? Learn the Basics!

What is an API and why is it useful to you as a programmer? Let’s talk about that today.


Again, the question was, “What is an API and why is it useful to you as a programmer?” Well firstly, API stands for Application Programming Interface. What it is, you can really consider it as the middleman, the middle bit of code that sits between the code what you write and the code or pre-written code that someone else has written.


So basically, it gives you the ability as a programmer to access that other code in a logical way. Without that, you have to write all those other codes yourself and an API gives you the ability to access this other code. Now consider an example, the unreal game engine. Now, the purpose of that game engine is to shortcut game development. So it’s basically the infrastructure to create computer games. Basically that’s a bunch of pre-written code that tonnes of programmers have accessed and used and developed over the years. And there’s all manner of game related stuff, things like player movement, camera positioning and all those sorts of things.


So that said, where does the API come into this again? The API is the way for your code again, to use this pre-written code. It defines how you can access the specific functionality in your own programs. Now, there’s nothing really magical about it, it’s really just a way for you to be able to access this code, this pre-written code, from the code that you develop yourself. API documentation is very important here, because documentation helps you how to understand how to use the API. The good thing is that these days all commercial APIs, which every real game engine’s got its own API, has got good documentation. So that outlines the methods, the functionality, the properties and so forth, that you need to access and use, so that you can take advantage of this pre-written software.


Now, what’s really important here is that you can also use APIs in your programs. So you can actually create a program yourself and you can create an API for it. So again there’s nothing magical about APIs, it’s just a way for you to access, or give someone else access to your program. Now a typical way, that you might start using an API for your own programs is when you wanna share data. So you might create a basic program that tracks some information or stores some information and you wanna start sharing that information with others, you would create an API, an Application Programming Interface, that defines and gives a method or way for other programmers or other programm to get access to your code to your data from your program.


Basically again, there’s nothing really magical about it, it’s just a typical way that you would actually give people access to that data. So it’s just defining an entry point to get access to that data. Now, an API itself can be small or large, it can be simple or complex. There’s nothing, again I’ve said this a few times, there’s nothing magical about it. So with that said, what’s the biggest reason that you’d want to use an API? Well, hopefully that’s become apparent in the video posted above. It’s basically to get access to this code that’s been developed by other people. And getting back to the game analogy again, we’ll go back to the unreal game engine. Now because that code exists, and there’s an API for you to access it, you don’t have to create your own game engine.


When I started out developing in the late 70s early 1980s, if you wanted to create a game, you’d have to write all the code to do absolutely everything. To position the player, to draw things on the screen and so forth. So every game project, would involve an all this extra code. But these days you can use something like the unreal game engine. It does a lot of that work for you, so you can concentrate on the unique characteristics of your game, knowing that all those things like moving players on the screen and tracking things and moving cameras, positioning cameras and so on, the code to do that already exists you just write a bit of code that accesses the API method call for that particular bit of functionality and it’s written already and it actually works.


So again you’re just then confirming or focusing on your code specific to your individual game. And you can see that by doing that you’d save a heck of a lot of time, versus having to go through and write the entire game engine as well as your codes yourself. I’ve used the game analogy a couple of times now, but the same thing also exists in business software. Another example is XERO. That’s a very popular online finance program for businesses. So you can use that to keep track of your finances and give access to your accountant, to access those finances and so forth.


XERO has also got an API. So you can use that API, to get access to your data in different ways. So perhaps there’s a bit of functionality that you wanna get access to, you wanna manipulate your data in some way that the standard XERO software doesn’t allow you to or perhaps you want to grab the data from another finance package and import it into XERO, you’d be using an API. You could write some code to actually do that, to transfer that, and get that working if you wanted to do that. So you can see that instead of creating your own accounting program from scratch in this case you can leverage XERO, again a very popular accounting package and you could use the functionality for that and then basically get the data in or take the data out or just basically access functionality with XERO without having to write your own accounting program from scratch.


So that’s it. That’s all there really is to an API, Application Programming Interface. I hope that helped. If you’ve got any questions, feel free to leave a comment and I’ll get back to you.

14 views0 comments
bottom of page