views:

94

answers:

3

When and where we use an API feature in our website?

what are the advantages of APIs?

How to write API's programs?

Is there any reference for how to create API's?

Or structure of API Applications?

These are the general questions, please do let me know your thoughts about APIs.

I think my question is clear for all :)

thanks in advance!

+3  A: 

Any time you're providing information that anyone will be tempted to automatically retrieve by scraping your site (downloading documents and analyzing the HTML to extract the information), you can make everybody's life simpler and easier by providing an API to retrieve it with instead.

And in "everybody", I am emphatically including you. When people retrieve via an API instead of scraping, it reduces load on your servers and improves your analytics.

chaos
is there any reference for how to create API's?or structure of API Applications
coderex
I would go look for an open source web application that provides API functionality and see what it does, if I were you.
chaos
Go with either web services, a REST based XML request API or - best - OData.
TomTom
+1  A: 

Q: Do I need an API?

If your site is big enough to merit having applications written for it, and you know there are people out there who will do so, or you plan on doing so then you might want to think about an api. Allowing users to add their own features to your site experience can be great, if it happens.

Sites that need apis:

facebook. Huge, nuff said. so popular that people will write for it, because they can make money at it too.

SO: decent sized, plus full of programmers so stuff'll get written.

CrazyJugglerDrummer
+1  A: 

There's multiple answers to your question on how to create an API on stackoverflow. Try searching for "creating an api". Or have a look here.

As for your other questions, I think that providing an API is a nice invitation for your users to take advantage of your features/content/whatever (stuff) in ways they want. It shows that you think of them and make your stuff easily accessible.

From your point of view an API gives you more control over how people use your site, thus minimizing the risk and frustration of abuse.

Another reason for an API is if you're on a market competing with other projects or companies and they provide it. Then it'll probably be a good idea to keep up with them.

But generally, whether you should have an API or not depends entirely on the stuff you're providing. Your first consideration will have to be if there's a reason for doing one. Is it worth your effort? Will anybody use it?

Try to put yourself in your user's position.

anderstornvig