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.

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.

An API is a list of function declarations, or something in that spirit.

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...

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.

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.

thanks a lot everyone.

It's a way for third-party developers to pull in elements of our site into their own site. I think Wikipedia can probably explain it more concisely than I can: http://en.wikipedia.org/wiki/API

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.