0

I'm having trouble understanding the concept of an API. Could someone please explain what exactly and API does? A simple code example (if that's possible with this subject) would be really useful and much appreciated.

5
Contributors
7
Replies
8
Views
7 Years
Discussion Span
Last Post by mackone
0

I'm having trouble understanding the concept of an API. Could someone please explain what exactly and API does? A simple code example (if that's possible with this subject) would be really useful and much appreciated.

API == Application Programming Interface.

Application: You have an existing piece of software you'd like to use. For example, the Flickr API or the Canon SDK.

Programming: You're writing your own software to make use of the existing application. For example, your own version of the Flickr Uploadr or a program to control a camera to do time-lapse photography.

Interface: This is the details of how your software communicates with the existing application. This can vary widely, depending on the technology of the existing application and the language in which you're writing your own program. For example, one way of using the Flickr API is through RESTful Web requests (e.g., upload, delete); the Canon SDK is presented as a native library written in C whose API is a collection of C functions that use handles to refer to specific cameras, sets of configuration parameters, and files on a camera's data card.

APIs can be more fully object-oriented, like MOGRE--or much closer to the hardware, like programming for the Nintendo DS. In the case of the DS, there are a variety of ways to make it work, including writing to hardware-mapped memory locations and calling BIOS software interrupts.

0

API == Application Programming Interface.

Application: You have an existing piece of software you'd like to use. For example, the Flickr API or the Canon SDK.

Programming: You're writing your own software to make use of the existing application. For example, your own version of the Flickr Uploadr or a program to control a camera to do time-lapse photography.

Interface: This is the details of how your software communicates with the existing application. This can vary widely, depending on the technology of the existing application and the language in which you're writing your own program. For example, one way of using the Flickr API is through RESTful Web requests (e.g., upload, delete); the Canon SDK is presented as a native library written in C whose API is a collection of C functions that use handles to refer to specific cameras, sets of configuration parameters, and files on a camera's data card.

APIs can be more fully object-oriented, like MOGRE--or much closer to the hardware, like programming for the Nintendo DS. In the case of the DS, there are a variety of ways to make it work, including writing to hardware-mapped memory locations and calling BIOS software interrupts.

Thanks a LOT! Really useful information there. So an API is like a go between for the different applications right? If I call a certain function in the API, it will do something using the application sitting behind it...

0

So an API is like a go between for the different applications right? If I call a certain function in the API, it will do something using the application sitting behind it...

Right. It might help to distinguish between the API and the application behind it--the API is more of a contract that is implemented/supported by the application when your software makes the calls.

0

An API just defines what kind of functions you can use. Sometimes these just do something like allow you to write a GUI in Swing and sometimes it would allow you to do stuff like gusano mentioned with uploading on flikr.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.