getByUID()

Description

Get data from the database table by UID

Request

Parameters

FieldRequiredData TypeDescription

uid

string

UID of the object to get

options

Object

Options Object describing filtering, sorting, and other options

Options Object Parameters

FieldRequiredData TypeDescription

includes

Array of string

An array of columns with one-to-one or one-to-many references that you would like to include in your response. For one-to-one reference the value will be returned as an object containing the includes in place of the reference value. For one-to-many reference the value will be returned as an array of objects containing the includes in place of the reference value.

Examples

Get by UID

const product = await client.database().from('products').getByUID("inom3bu91webuywd1ub9bu9dw1")

Get by UID with includes

const product = await client.database().from('products').getByUID("inom3bu91webuywd1ub9bu9dw1", {
    includes: ["category"]
})

Response

Parameters

FieldData TypeDescription

data

Object

Object containing all database item values

meta

Object

Object containing metadata

Metadata Parameters

FieldData TypeDescription

total

number

Total number of items in with the given UID Always equal to 1

page

number

Current page number Always equal to 1

limit

number

Current limit per page Always equal to 1

includesCount

number

Number of additional requests for the includes operations

Example

This is an example response to the Get by UID with includes request example above.

{
    "data": {
        "name": "T-Shirt",
        "price": 10,
        "category": {
            "uid": "n10234b901489bwduih1dw91",
            "name": "clothing"
        },
        "createdAt": "2022-08-22T16:04:49-04:00",
        "updatedAt": "2022-08-22T16:04:51-04:00"
    },
    "meta": {
        "total": 1,
        "page": 1,
        "limit": 1,
        "includesCount": 1
    }
}

Last updated