Skip to content

Get all

Structure

Structure
let getAll = await g.sys.db.getAll({
    instance: "INSTANCE_NAME",
    database: "DATABASE_NAME",
    collection: "COLLECTION_NAME",
    queryParams: {
        deep: JSON.stringify([{
            s_key: "SOURCE_COLLECTION_COLUMN_NAME",
            t_key: "TARGET_COLLECTION_COLUMN_NAME",
            t_col: "TARGET_COLLECTION_NAME",
            select: "COLUMN_NAMES"
        }]),
        select: "COLUMN_NAMES",
        limit: 2,
        sort: "COLUMN_NAME"
    }
});

Get all data

Get all data from table 'customers'
1
2
3
4
5
let getAll = await g.sys.db.getAll({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
});

With header

Get all with header
1
2
3
4
5
6
7
8
let getAll = await g.sys.db.getAll({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    headers: {
        "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
});

With queryParams

Get all with queryParams
let getAll = await g.sys.db.getAll({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    queryParams: {
        find: {
            first_name: 'James',
        },
    },
}, true);

Structure

Structure of get all schema API
let getAll = await g.sys.db.getAll({
    instance: "INSTANCE_NAME",
    database: "DATABASE_NAME",
    collection: "COLLECTION_NAME",
    headers: {
        "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        "x-am-response-object-type": "make_flat", // no_action | make_flat
        "x-am-meta": "true", // true, false
        "x-am-secret": "PROVIDE_SECRET_ID",
        "x-am-internationalization": "USER_I18N_ID",
        "x-am-run-in-sandbox": "2",
        "x-am-content-type-response": "text/xml", // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        "x-am-cache-control": "reset_cache", // no_action | reset_cache
        "x-am-get-encrypted-data": "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
        "x-am-sandbox-timeout": "13000",
        "x-no-compression": "true", // true | false
        "x-am-encrypted-payload": "true", // user will send 'true', when payload is encrypted for transfer
        // Authorization headers
        "x-am-authorization": "AUTHORIZATION_TOKEN",
        "x-am-user-authorization": "API_USER_TOKEN",
        "x-aws-authorization": "AWS_TOKEN",
        "x-google-authorization": "GOOGLE_TOKEN",
        "x-azure-authorization": "AZURE_TOKEN",
    },
    queryParams: {
        find: {
            "COLUMN_NAME": "COLUMN_VALUE"
        },
        skip: 1,
        limit: 5,
        sort: "COLUMN_NAME",
        select: "COMMA_SEPARATED_COLUMN_NAMES",
        getTotalCount: true,
        deep: [
            {
                s_key: "SOURCE_COLLECTION_COLUMN_NAME",
                t_instance: "TARGET_INSTANCE_NAME",
                t_db: "TARGET_DATABASE_NAME",
                t_col: "TARGET_COLLECTION_NAME",
                t_key: "TARGET_COLLECTION_COLUMN_NAME",
                find: {
                    "COLUMN_NAME": "COLUMN_VALUE"
                },
                isMultiple: true,
                limit: 10,
                select: "COMMA_SEPARATED_COLUMN_NAMES",
                skip: 2,
                sort: "COLUMN_NAME",
                deep: [
                    {
                        s_key: "SOURCE_COLLECTION_COLUMN_NAME",
                        t_instance: "TARGET_INSTANCE_NAME",
                        t_db: "TARGET_DATABASE_NAME",
                        t_col: "TARGET_COLLECTION_NAME",
                        t_key: "TARGET_COLLECTION_COLUMN_NAME",
                        find: {
                            "COLUMN_NAME": "COLUMN_VALUE"
                        },
                        isMultiple: true,
                        limit: 10,
                        select: "COMMA_SEPARATED_COLUMN_NAMES",
                        skip: 2,
                        sort: "COLUMN_NAME",
                    }
                ]
            }
        ]
    },
}, true);