The term API means, application programming interfaces which are some standard methods to share information. There are two types of APIs: desktop and web.
In desktop applications, the operating system provides a collection of APIs to run the programs, whereas, in web applications a full range of APIs are required to pass XML data, use interfaces and exchange information. Twitter is very important to many websites, not only for sharing information and thoughts, but also for advertising, marketing and searching. As we all know, twitter appears on many professional and non-professional websites and a simple ‘follow me’ badge is displayed in the sidebar.
Twitter has provided us with some APIs which enables a programmer to develop own applications for interfacing with twitter. One can develop these applications using PHP, OAuth and many other languages. One can even build websites using these twitter APIs. The twitter APIs supports data formats like; XML, RSS, JSON and Atom syndication formats. There are many tools and applications which help the user do a lot with twitter. There are many ways to interface with the twitter’s web services and all these are documented on their API.
Twitter uses a method called as RESTful approach meaning Representational State Transfer which uses URLs as interfaces for reading and writing information. To communicate with twitter API many developers are approaching OAuth which includes many things like; following, tweeting and many other API calls. Before creating any application one must communicate with twitter API through OAuth. One needs to fill the online application form to create the twitter applications. Log into the twitter account where your application will be working. One must use a valid twitter account. Go to the twitter developer site and click the link to register an application. Describe the application in the form and fill the necessary fields like; application name, description, application website, type, organization, default access type and callback URL. After filling these details, you will be provided with an information page for this application. Note the information from the pages as these are very important. Every application created for twitter is assigned some values called tokens and secrets. One has to copy these values from the correct place and paste them into the script. This is a little bit tough job to find the values. So, one has to move very slowly.
After getting the OAuth values, one has to get the application’s OAuth values which are available by clicking the My Access Token option. Copy and save these values. Now, one must decode the twitter API docs and find parameters for the API call. Finally, one needs to write a script to post the tweets and run the test script. If the test runs successfully, the twitter API returns a response code of 200. If there is any error code the API returns a response code of 403, which means the API request was rejected.
There are a lot of tutorials, references, plug-ins and libraries available online which will help users to do everything they want to do with twitter on their twitter developers site.
Image Credit seokchanyun