A vast majority of applications both deployed, and in development today, rely heavily on REST API’s to interact with data sources. Whether it be to read, insert, update or delete information – a REST API provides a standard URL interface to make those changes.
Out of the box as part of a StarbaseDB deployment you have a REST API available to you where you can interact with your resources with optional custom properties to help filter down to the specific data you are looking for.
URL Structure
All of our REST path structures begin with the path /rest/
to indicate that what follows in the URL should be properly routed through our REST API application logic. The second component of the URL path structure is always the table name you are looking to interact with. For some endpoints, such as our DELETE
, PUT
, and PATCH
operations a third path structure is present that identifies the unique primary identifier of the object you are trying to interact with - such as an id
column.
https://starbasedb.YOUR-IDENTIFIER.workers.dev/rest/TABLE_NAME
Each operation has its own HTTP verb associated to it in order to help differentiate between what underlying actions are being taken with your data. Reference the table below for those verbs & actions.
Verb | Action |
---|---|
GET | Retrieves a resource |
POST | Creates a resource |
DELETE | Deletes a resource |
PUT | Updates a resource with a full replacement (all fields) |
PATCH | Updates a resource with a partial replacement (some fields) |
Filter Parameters
We allow for query params at the end of the routes, particularly for the Retrieve Resource endpoint, so you can narrow down the results that are returned back to you. Below is a list of these query params and an example for each.
You can combine multiple query params to get more granular filtering!
Operation | Example |
---|---|
Equals |
|
Not Equals |
|
Like |
|
In |
|
Greater Than |
|
Greater Than or Equal |
|
Less Than |
|
Less Than or Equal |
|
Sort By |
|
Order |
|
Limit |
|
Offset |
|
TBD