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 items. By providing the database item "_type" and the required item properties, you can query and modify database items.

Create

Endpoint

HTTP
POST /generic/create

Authorized User Role

user

Request Body

FieldTypeRequiredNotes
_typestringyesDatabase item type.
deviceIdstringDevice ID owning the item. This must be a deviceId claimed by the manager account of the authenticated user.
*anyItem attributes to create.

Query String Options

FieldTypeNotes
existsbooleanSet to true to require the item exists, otherwise set to null to perform an upsert.

Response

The created item.

FieldTypeNotes
_typestringDatabase item type.
*anyItem attributes.

Get

Get a data item from a database table.

Endpoint

HTTP
POST /generic/get

Authorized User Role

user

Request Body

FieldTypeRequiredNotes
_typestringyesDatabase item type.
deviceIdstringDevice ID owning the item.
*anyOptional item attributes to filter the selected item.

Response

The retrieved item.

FieldTypeNotes
*anyItem attributes.

Find

Find data items from a database table.

Endpoint

HTTP
POST /generic/find

Authorized User Role

user

Request Body

FieldTypeRequiredNotes
_typestringyesDatabase item type.
deviceIdstringDevice ID owning the item.
*anyOptional item attributes to filter selected items.

Query String Options

FieldTypeNotes
filterstringFull text string to filter for.
nextobjectPagination token for the next page.
prevobjectPagination token for the previous page.
limitnumberNumber of items to retrieve.
indexstringDatabase index to use.
existsbooleanSet to true to require the item exists, otherwise set to null to perform an upsert.

Response

Paged response.

FieldTypeNotes
dataarrayAn array of devices owned by the user.
nextstringPaged cursor to use for the next page of items.
prevstringPages cursor to use for the previous page of items.

Item

An array of Item items.

FieldTypeNotes
*anyItem attributes.

Remove

Remove a data item.

Endpoint

HTTP
POST /generic/remove

Authorized User Role

user

Request Body

FieldTypeRequiredNotes
_typestringyesDatabase item type.
deviceIdstringDevice ID owning the item.
*anyOther item attributes sufficient to identify the item.

Update

Update a data item.

Endpoint

HTTP
POST /generic/update

Authorized User Role

user

Request Body

FieldTypeRequiredNotes
_typestringyesDatabase item type.
deviceIdstringDevice ID owning the item.
*anyOther item attributes sufficient to identify the item.

Response

The updated data item.

FieldTypeNotes
*anyItem attributes.