This is an archived copy of a previous semester's site.
Please see the current semester's site.
Web server complexity can be roughly divided into three levels:
A stateless server does compute part of the content, but does so based only on the current request; requests are not combined into sessions and do not otherwise interact with one another. Stateless usually also contain some static information. Static servers are a trivial subset of stateless servers.
The stateless
term is somewhat misleading: the server does maintain state and requests can modify that state, but the state is not divided into different state for different clients.
A particularly popular form of stateless server designs are web APIs that use the REST architectural style, also called REST APIs or RESTful Web APIs.
REST officially an abbreviation for representational state transfer
, though that longer term is rarely used. REST includes 5 properties:
In general, RESTful web APIs have the following properties:
Clients send HTTP requests; servers reply.
The HTTP request method describes if/how the request changes server state. The two most common methods used are
GET
does not change server statePOST
changes existing server stateSometimes PUT
is used to create new server state and DELETE
to remove existing server state, but sometimes they are both handled using POST
instead. Other HTTP request methods are relatively rarely used in web APIs.
The HTTP request path identifies what resource you are accessing.
The HTTP request body (which is not used by GET
requests) describes specific changes to be implemented.
HTTP headers may be used to pick one of several equivalent response formats, but should not be used to change the meaning of the request.
All request bodies within a single API use the same format; often JSON or XML, but sometimes the simpler but less flexible application/x-www-form-urlencoded
and multipart/form-data
formats used by HTML forms and query strings.
All response bodies that provide structured data structure it the same way, often JSON or XML.