Example Calls
What follows are several example calls to the API. Each example should be matched by an example call in the demo project. Several words are reserved for use by the API. In some cases, an alias for the reserved word also exists. A complete list is available here.
The examples will work on a fictional end point USERS and demonstrated in the sister application. In most cases, multiple modifiers can be chained together such as search for a specific value and limiting the number or records returned.
This URL will show a sort of sitemap for the API. It describes all routes and VERBS supported by the api.
Notice that the API supports versioning, all subsequent examples will use a default "v1" incorporated into the URL but this is arbitrary and defined by YOU the developer.
Show all available records stored in the API
Show only the user record with an ID of 1.
Show the first 5 user records. (Aliases: per_page, perPage)
Show the 2nd group of 5 records. Useful for displaying paginated result sets. (Aliases: page)
Sort the resulting records by any value known to that table or tables related by a hasOne relationship. Default is to sort in descending order. To sort in ascending order, prefix the field name with a dash. ie. /v1/users/?sort=-last_name. To sort by multiple fields, separate each field by a comma. ie. /v1/users?sort=-last_name,+first_name (Aliases: sort_field, sortField)
Show only records that contain a last_name value of "Watson". Searches are performed by the underlying SQL database. Depending on the character encoding of the database and table, searches may be case sensitive or not.
The API supports filtering by multiple fields and treats each additional filter as an AND when searching.
A wildcard filters records to only include those with a last_name that begins with "wat". Several variations on this are builtin such as last_name=wat or last_name=*wat.
Search for multiple values in the same field by concatenating search values with a double pipe as in...||.
Side load related tables. The API supports side loading one or more specific tables separated by commas. (Alias: include)
Since each end point can be configured to auto sideload some or all related tables. The API will sideload all tables with the value "all" and will not sideload any tables with the value "none".
The API supports searches against columns in a joined table. In this case, only return address records where the user's last_name field equals "Watson".
To reference a related table's field, use this syntax: TABLE:FIELD.
User comparison operators such as > or <. Possible supported operators are:
>, >=, <=, <
These characters should be URL encoded as described here.
ie. /v1/users?age=<21 becomes /v1/users?age=%3C21
The API allows to return only the meta data of a request to get only counters instead of the full response. This is achieved by adding the parameter count to the query string.