From WikiPedia (https://en.wikipedia.org/wiki/Application_programming_interface): > In computer programming, 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, defining 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, which are then put together by the programmer.
Also from WikiPedia (https://en.wikipedia.org/wiki/Representational_state_transfer):
> In computing, representational state transfer (REST) is the software architectural style of the World Wide Web.[1][2][3] REST gives a coordinated set of constraints to the design of components in a distributed hypermedia system that can lead to a higher-performing and more maintainable architecture.
>
> To the extent that systems conform to the constraints of REST they can be called RESTful. RESTful systems typically, but not always, communicate over Hypertext Transfer Protocol (HTTP) with the same HTTP verbs (GET, POST, PUT, DELETE, etc.) which web browsers use to retrieve web pages and to send data to remote servers.[4] REST interfaces with external systems using resourcesidentified by Uniform Resource Identifier (URI), for example /people/tom
, which can be operated upon using standard verbs, such as DELETE /people/tom
.
So, what does these terms has to do with me? Well, I’m a web developer, and in this busy world we live on, we constantly needs to connect with other systems, and make then parse data. Well, this was a trouble at the ancient time, we didn’t have a standard way of doing it, and we had to parse web pages, so we could fetch results, simulate user interaction so that we could insert content and so on.
When I’m working with PHP and our projects I tend to use a PHP class, slightly modified, that parses a list of classes using PHP Reflection class, and it’s comments generates the mapping, example:
https://gist.github.com/tryvin/5c1fc37096b575d63c2a
You see the pattern, where we map HTTP methods into a CRUD (Create, Read, Update, Delete) handler, so, everyone will know that to create a user they just need to POST into the url /users/new, to get a list of all users they connect with /users, and to delete some user, they use the DELETE HTTP method into the url /user/<userId>.
Why is this easier? Think that you only need to create four methods, that do some simple http requests, and you are all set to interact with this server. Instead of doing a request, then a scrap, then ordering the data, or simulating a user form, and submiting this data, then scrapping the response.
We have a new project at PayGate where hostels, and hotels would interact with these booking sites like Booking.com, HostelWorld, and so on. Sadly, booking.com doesn’t have some RESTful API =/, Bad bad booking.com, no donut for you =/