What I want and have
I’m willing to create an API, I already know what does an API stands for.
I use PHP as a server side language.
However I don’t really understand how an API works from scratch, and how can I enable users to use my API after I created it.
What I think and know
Well right now I think that with an API I enable developers to reach my database and request queries. But then why should I create a full language for it? Why can’t they use PHP or any other server side language?
As I saw, companies who crates API’s for their site, they require a registration to give to developers an API KEY. Does the developers log in to database trough this API KEY? And if yes, then why they don’t have a password too? If I know somebody’s API KEY I can use it or what?
And as I read/heard XML is related somehow to API’s, but why and how?
Also please consider in your answers that I don’t want to use any frameworks or something like that, I want to make it in scratch so I want to understand how it works from A to Z.
An API is really just methods that you publicly expose. Say, for example, you have a blog site. You want your members to be able to post a blog entry without actually coming to your site – logging in, filling out a form, etc..
Perhaps they want to create an Android/IPhone app to post to your cool blog site. You can allow them to do that.
Create an API for this:
A couple things:
*http://myblogsite.com/blog.php?memberEmailAddress=myEmal@example.com&memberPassWord=myPass&BlogTitle=Title-of-post&BlogBody=the_blog_post_is_here*
One thing you need to understand, is that there has to be a need for an API. You can expose a method to create a blog entry, but if no one knows about it or uses it – it’s worthless. API’s need to be documented, advertised, and provide a benefit to potential users.