Request overview
Requests to the REST API of a RESTable application are standard HTTP requests. Encoded in a request is all information necessary to perform a certain operation on a given resource. RESTable has multiple resource kinds, that have slightly different methods of interaction, but let’s stick with entity resources for now, since they are the ones most commonly used. To further explore the components of HTTP requests to a RESTable application, use the links below:
Method
Methods define the operation to perform on the selected resource
URI
URIs select the resource to operate on, and contain additional instructions for how the request should be processed.
Headers
Headers define high-level request parameters like authorization and content types.
Body
The body of the request is used to communicate content, for example a JSON representation of an entity, to the REST API.
Examples
The easiest way to familiarize oneself with how to consume a RESTable API, is to make real requests to an actual RESTable API. The URI examples below are written as relative URIs for the sake of brevity. The relative uri /superhero would generate the absolute URI https://myapp.com/api/superhero.
Some example URIs:
1
2
3
4
5
6
7
8
9
10
11
List the first 10 superheroes: /superhero//limit=10
Superheroes 15 to 20 (exclusive): /superhero//limit=5&offset=14
All female superheroes: /superhero/gender=Female
5 male heroes with secret identities: /superhero/gender=Male&hassecretidentity=true/limit=5
Female heroes introduced since 1990: /superhero/gender=Female&yearintroduced>=1990
All male superhereoes' names: /superhero/gender=Male/select=Name
| + length of the name: /superhero/gender=Male/add=name.length&select=name,name.length
| Ordered by name length: /superhero/gender=Male/add=name.length&select=name,name.length&order_asc=name.length
Years when a superhero was introduced: /superhero//select=yearintroduced&distinct=true&order_asc=yearintroduced
Make a superhero report: /superheroreport
| + weekday of first inserted as "Day" /superheroreport//add=firstsuperheroinserted.insertedat.dayofweek&rename=firstsuperheroinserted.insertedat.dayofweek->Day