Introduction

Ready-made REST API available for CRUD operations on your SQL tables.


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

/rest/users?name=”Alice”

Not Equals

/rest/users?name.ne=”Alice”

Like

/rest/users?name.like=”Al%25”

In

/rest/users?name.in=”Alice,Bob”

Greater Than

/rest/users?user_id.gt=0

Greater Than or Equal

/rest/users?user_id.gte=1

Less Than

/rest/users?user_id.lt=100

Less Than or Equal

/rest/users?user_id.lte=99

Sort By

/rest/users?sort_by=user_id

Order

/rest/users?order=DESC

Limit

/rest/users?limit=10

Offset

/rest/users?offset=10

TBD

Updated on