What are REST resources?

The reason why articles on REST resources are abstract is because the concept of a REST resource is abstract. It's basically "whatever thing is accessed by the URL you supply". So, in your example, the resource would be the list of two users starting at offset 5 in some bigger list. Note that, how the resource is implemented is a detail you don't care about unless you are the one writing the implementation.

Is the following URL a resource?

The URL is not a resource, it is a label that identifies the resource, it is, if you like, the name of the resource.

The JSON is a representation of the resource.


What’s a Resource?

A resource is anything that’s important enough to be referenced as a thing in itself. If your users might “want to create a hypertext link to it, make or refute assertions about it, retrieve or cache a representation of it, include all or part of it by reference into another representation, annotate it, or perform other operations on it”, then you should make it a resource.

Usually, a resource is something that can be stored on a computer and represented as a stream of bits: a document, a row in a database, or the result of running an algorithm. A resource may be a physical object like an apple, or an abstract concept like courage, but (as we’ll see later) the representations of such resources are bound to be disappointing. Here are some possible resources:

  • Version 1.0.3 of the software release
  • The latest version of the software release
  • The first weblog entry for October 24, 2006
  • A road map of Little Rock, Arkansas
  • Some information about jellyfish
  • A directory of resources pertaining to jellyfish
  • The next prime number after 1024
  • The next five prime numbers after 1024
  • The sales numbers for Q42004
  • The relationship between two acquaintances, Alice and Bob
  • A list of the open bugs in the bug database

The text is from the O'Reilly book "RESTful Web Services".