Skip to content

Generic

Generic Access to Database Data.

The Generic controller provides "generic" access to database items without requiring specific database models for different database item entities. By providing the database item "_type" and the required item properties, you can query and modify database items.


Create

Endpoint

1
POST /generic/create

Authorized User Role

1
user

Request Body

Field Type Required Notes
_type string yes Database model type.
deviceId string Device ID owning the item. This must be a deviceId claimed by the manager account of the authenticated user.
* any Model item attributes to create.

Query String Options

Field Type Notes
exists boolean Set to true to require the item exists, otherwise set to null to perform an upsert.

Response

The created item.

Field Type Notes
_type string Database model type.
* any Model item attributes.

Get

Get a data item from a database table.

Endpoint

1
POST /generic/get

Authorized User Role

1
user

Request Body

Field Type Required Notes
_type string yes Database model type.
deviceId string Device ID owning the item.
* any Optional item attributes to filter the selected item.

Response

The retrieved item.

Field Type Notes
* any Model item attributes.

Find

Find data items from a database table.

Endpoint

1
POST /generic/find

Authorized User Role

1
user

Request Body

Field Type Required Notes
_type string yes Database model type.
deviceId string Device ID owning the item.
* any Optional item attributes to filter selected items.

Query String Options

Field Type Notes
filter string Full text string to filter for.
next object Pagination token for the next page.
prev object Pagination token for the previous page.
limit number Number of items to retrieve.
index string Database index to use.
exists boolean Set to true to require the item exists, otherwise set to null to perform an upsert.

Response

Paged response.

Field Type Notes
data array An array of devices owned by the user.
next string Paged cursor to use for the next page of items.
prev string Pages cursor to use for the previous page of items.

Item

An array of Item items.

Field Type Notes
* any Model item attributes.

Remove

Remove a data item.

Endpoint

1
POST /generic/remove

Authorized User Role

1
user

Request Body

Field Type Required Notes
_type string yes Database model type.
deviceId string Device ID owning the item.
* any Other item attributes sufficient to identify the item.

Update

Update a data item.

Endpoint

1
POST /generic/update

Authorized User Role

1
user

Request Body

Field Type Required Notes
_type string yes Database model type.
deviceId string Device ID owning the item.
* any Other item attributes sufficient to identify the item.

Response

The updated data item.

Field Type Notes
* any Model item attributes.