Web Applications¶
A web application is a program that responds to HTTP requests. A web application can be used to provide a web site with interesting behavior. For example, a search on google.com forwards the parameters to a program that actually performs the search, and then responds with a list of (hopefully) relevant links.
Many web applications are designed to be a RESTful API, defined below.
REST¶
A REST (representational state transfer) API refers to a system of
communication that is used to exchange information over the world-wide
web. There are two important ideas behind a REST API. First, there are
resources identified by a URL. The URL https://www.wikipedia.org/ is a resource for the home page of
Wikipedia, while the URL
https://en.wikipedia.org/wiki/Representational_state_transfer is a
resource for the page on REST. The second are verbs that can be used
to interact with a resource. These verbs include GET
, PUT
,
POST
, and DELETE
. The GET
verb is used to retrieve
information from a resource; this is what happens when you click on
either of the links above. PUT
and POST
are used to send
information to a resource; this might be used to send search terms to
a search engine, or to send user information to a sign-up page. What
happens when certain verbs are used on certain resources is entirely
up to the web service providing them, although there are conventions
that should be followed.
RESTful APIs¶
A RESTful API is simply an API that follows the REST architecture. Such an API can respond to requests with any type of information; it can return an HTML web page, a JSON document, or an image. We will create web services that return both statically and dynamically generated documents.