ROA is primarily based on the concept of a resource. A resource is a distributable component that can be accessed through a standard, common interface. Each resource is associated to a unique identifier that comprises a URL.
The main concepts of ROA are centered on resources. Resources should have the following characteristics:
Although a resource link is used to represent another representation of the same resource or another resource, a resource interface is used to provide an interface to access a resource and manipulate its state information. A resource is represented using URIs. Note that data is a resource if it can be represented using a URI.
Examples of resources and URIs are as follows:
No two resources can be the same, but two or more resources can point to the same data. Here is an example:
http://www.packtpub.com/sales/2012/Q4
http://www.packtpub.com/sales/2012/Q3
The following figure shows the relationship amongst a resource, its representation, and its URI:
The six basic properties that an ROA implementation should hold include the following:
The four basic concepts that an ROA implementation should hold include:
In this section, we will discuss the basics of HTTP protocol.
The following table shows the common HTTP methods and their purpose:
The following table shows the HTTP status codes and their purposes:
Status code |
Description |
---|---|
100 |
Informational |
200 |
Successful |
201 |
Created |
202 |
Accepted |
300 |
Redirection |
304 |
Not modified |
400 |
Client error |
402 |
Payment required |
404 |
Not found |
405 |
Method not allowed |
500 |
Server error |
501 |
Not implemented |
The following table shows the HTTP redirection status codes:
Status Code |
Description |
---|---|
300 |
Multiple choices |
301 |
Moved permanently |
302 |
Found (temporary redirection) |
The following table shows the HTTP error status codes:
Status code |
Description |
---|---|
400 |
Bad request |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Resource not found |
405 |
Method not allowed |
408 |
Request timeout |
409 |
Conflict |
413 |
Request entity too large |
415 |
Unsupported media type |
The following table shows the HTTP server error status codes:
Status Code |
Description |
---|---|
500 |
Internal server error |
501 |
Not implemented |
503 |
Service unavailable |
505 |
HTTP version not supported |
The following table lists some resource methods and how they can be implemented using the HTTP protocol:
In the section that follows, we will explore ROA. We will discuss what a resource implies, the constraints, and so on.