What is API?

The official Wikipedia  definition is:

An application programming interface (API) is a set of routines, protocols, and tools for building software applications. An API expresses a software component in terms of its operations, inputs, outputs, and underlying types. An API defines functionalities that are independent of their respective implementations, which allows definitions and implementations to vary without compromising the interface. A good API makes it easier to develop a program by providing all the building blocks. The programmers then put the blocks together.

In a layman's term, APIs

It is a piece of code that is put together for you to use that will help you create web applications faster.  For example,  if you want to know the country of a IP address, you can use API to get that information.

2 Different Kinds Of APIs

1) Client Side:

Javascript or jQuery is a well-known script that helps in invaliding data before sending it to the server.

For example, if you have 3 fields (name, password, and email) and you want to make sure that your user enter’s in the correct format for email, you can use jQuery to valid that.

2) Server Side:

This is a communication from one server to another.

For example, if you want to take a long url and shorten it, you do this with server side APIs.

Where To Find Javascript API’s

There are all kinds of websites out there that host APIs for you to use. One of them being Google API.  In my experience, Google host’s a limited amount of APIs. I prefer to use CDNJS (Content Delivery Network JavaScript).

CDNJS has a lot of APIs that they host. If you can think of an API that you want to use for your web development project,  I'm pretty sure you could find it there.  I have used this site for all of my web development projects and they have hundreds if not thousands of JavaScript APIs that you can use.

What are the benefits of using API's on external hosted sites?

If you have a limited amount of bandwidth that you are allowed to use per month, by using external hosting API’s you won’t have to worry about using your own bandwidth because you will be using external hosted API’s bandwidth.

How do you use API?

If you want to use jQuery that is hosted on CDNJS site. You can search for  jQuery on their site and pick whichever version you want to use from their drop down section.

I would suggest you use “mini” version because it’s file size is small.

Then you can include it in your web development project like this :

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

After this, you will be able to use all of it’s functionality that jQuery has to offer in your web application.

Paid APIs

When you want to use server side API’s, then will you will have to pay depending on what your web application is trying to do.

Below are two that I would recommend you should check it out:

Twilio - you can send SMS messages via your web application.

Mashape - This site has hundreds of different APIs you can use for your project. For example, if you want to know which country does a particular phone number belongs to, you can look it up Via API. Or if you want to turn your HTML into PDF, you can make a API call to do that.

This site does give you plenty of options ( you can use any of these server side scripting languages - php, python,ruby, .net,java, and etc. ) to make api’s call.

If you want to create awesome web applications that are easy and fast to develop, you can piggyback on other people’s work by using API's and include them into your web project. If I were you, I would start off with CDNJS  website first.

I hope this helps you. Let me know what other API's sites that you use.





Post Comment