Skip to content
This page View Markdown Open in ChatGPT Open in Claude

Master save

The code in every language

Each example is the inside of main, written in every language API Maker runs : pick yours in the tabs, and every page shows it from then on. The types a call takes (GetAll, DeepItem…) are those of am : from am import GetAll in Python, use am::GetAll; in Rust, import am.GetAll; in Java and Kotlin ; PHP and C# have them without an import, Go names them am.GetAll.

g.sys.db.masterSave calls the master save schema API of any table from your code, with the same headers and query parameters as over HTTP. It returns the data. The whole envelope (success, statusCode, data, totalCount, errors…) comes back when true is passed as the second argument in TypeScript, and through full in the other languages : g.sys.db.full (g.Sys.Db.Full in C# and Go, $g->sys->db->full in PHP).

master save single data

Master save
1
2
3
4
5
6
7
let masterSave = await g.sys.db.masterSave({
    instance: "mysql_8", database: "inventory", collection: "customers",
    saveData: {
        "first_name": "Bob",
        "last_name": "Lin"
    }
});
Master save
1
2
3
4
5
6
7
master_save = await g.sys.db.master_save(
    'mysql_8', 'inventory', 'customers',
    {
        'first_name': 'Bob',
        'last_name': 'Lin',
    },
)
Master save
1
2
3
4
5
6
7
$masterSave = $g->sys->db->masterSave(
    'mysql_8', 'inventory', 'customers',
    [
        'first_name' => 'Bob',
        'last_name' => 'Lin',
    ],
);
Master save
1
2
3
4
5
var masterSave = await g.Sys.Db.MasterSave(new Save("mysql_8", "inventory", "customers", new JsonObject
{
    ["first_name"] = "Bob",
    ["last_name"] = "Lin",
}));
Master save
masterSave, err := g.Sys.Db.MasterSave(am.Save{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    SaveData: am.M{
        "first_name": "Bob",
        "last_name":  "Lin",
    },
})
if err != nil {
    return nil, err
}
Master save
1
2
3
4
5
6
let master_save = g.sys.db.master_save(
    Save::new("mysql_8", "inventory", "customers", json!({
        "first_name": "Bob",
        "last_name": "Lin",
    })),
)?;
Master save
1
2
3
4
var masterSave = g.sys.db.masterSave(new Save("mysql_8", "inventory", "customers", Map.of(
    "first_name", "Bob",
    "last_name", "Lin"
)));
Master save
1
2
3
4
5
6
val masterSave = g.sys.db.masterSave(
    Save("mysql_8", "inventory", "customers", mapOf(
        "first_name" to "Bob",
        "last_name" to "Lin",
    )),
)

master save multiple data

Master save
let masterSave = await g.sys.db.masterSave({
    instance: "mysql_8", database: "inventory", collection: "customers",
    saveData: [
        {
            "first_name": "Bob",
            "last_name": "Lin"
        },
        {
            "first_name": "Bob",
            "last_name": "Lin"
        }
    ]
});
Master save
master_save = await g.sys.db.master_save(
    'mysql_8', 'inventory', 'customers',
    [
        {
            'first_name': 'Bob',
            'last_name': 'Lin',
        },
        {
            'first_name': 'Bob',
            'last_name': 'Lin',
        },
    ],
)
Master save
$masterSave = $g->sys->db->masterSave(
    'mysql_8', 'inventory', 'customers',
    [
        [
            'first_name' => 'Bob',
            'last_name' => 'Lin',
        ],
        [
            'first_name' => 'Bob',
            'last_name' => 'Lin',
        ],
    ],
);
Master save
var masterSave = await g.Sys.Db.MasterSave(new Save("mysql_8", "inventory", "customers", new JsonArray
{
    new JsonObject
    {
        ["first_name"] = "Bob",
        ["last_name"] = "Lin",
    },
    new JsonObject
    {
        ["first_name"] = "Bob",
        ["last_name"] = "Lin",
    },
}));
Master save
masterSave, err := g.Sys.Db.MasterSave(am.Save{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    SaveData: []any{
        am.M{
            "first_name": "Bob",
            "last_name":  "Lin",
        },
        am.M{
            "first_name": "Bob",
            "last_name":  "Lin",
        },
    },
})
if err != nil {
    return nil, err
}
Master save
let master_save = g.sys.db.master_save(
    Save::new("mysql_8", "inventory", "customers", json!([
        {
            "first_name": "Bob",
            "last_name": "Lin",
        },
        {
            "first_name": "Bob",
            "last_name": "Lin",
        },
    ])),
)?;
Master save
var masterSave = g.sys.db.masterSave(new Save("mysql_8", "inventory", "customers", List.of(
    Map.of(
        "first_name", "Bob",
        "last_name", "Lin"
    ),
    Map.of(
        "first_name", "Bob",
        "last_name", "Lin"
    )
)));
Master save
val masterSave = g.sys.db.masterSave(
    Save("mysql_8", "inventory", "customers", listOf(
        mapOf(
            "first_name" to "Bob",
            "last_name" to "Lin",
        ),
        mapOf(
            "first_name" to "Bob",
            "last_name" to "Lin",
        ),
    )),
)

with header

Master save with header
let masterSave = await g.sys.db.masterSave({
    instance: "mysql_8", database: "inventory", collection: "customers",
    saveData: {
        "first_name": "Bob",
        "last_name": "Lin"
    },
    headers: {
        "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
});
Master save with header
master_save = await g.sys.db.master_save(
    'mysql_8', 'inventory', 'customers',
    {
        'first_name': 'Bob',
        'last_name': 'Lin',
    },
    headers={
        'x-am-response-case': 'capitalCase',  # noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
)
Master save with header
$masterSave = $g->sys->db->masterSave(
    'mysql_8', 'inventory', 'customers',
    [
        'first_name' => 'Bob',
        'last_name' => 'Lin',
    ],
    headers: [
        'x-am-response-case' => 'capitalCase', // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    ],
);
Master save with header
var masterSave = await g.Sys.Db.MasterSave(new Save("mysql_8", "inventory", "customers", new JsonObject
{
    ["first_name"] = "Bob",
    ["last_name"] = "Lin",
})
{
    Headers = new JsonObject
    {
        ["x-am-response-case"] = "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
});
Master save with header
masterSave, err := g.Sys.Db.MasterSave(am.Save{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    SaveData: am.M{
        "first_name": "Bob",
        "last_name":  "Lin",
    },
    Headers: am.M{
        "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
})
if err != nil {
    return nil, err
}
Master save with header
1
2
3
4
5
6
7
8
9
let master_save = g.sys.db.master_save(
    Save::new("mysql_8", "inventory", "customers", json!({
        "first_name": "Bob",
        "last_name": "Lin",
    }))
        .headers(json!({
            "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        })),
)?;
Master save with header
1
2
3
4
5
6
7
var masterSave = g.sys.db.masterSave(new Save("mysql_8", "inventory", "customers", Map.of(
    "first_name", "Bob",
    "last_name", "Lin"
))
    .headers(Map.of(
        "x-am-response-case", "capitalCase" // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    )));
Master save with header
1
2
3
4
5
6
7
8
9
val masterSave = g.sys.db.masterSave(
    Save("mysql_8", "inventory", "customers", mapOf(
        "first_name" to "Bob",
        "last_name" to "Lin",
    ))
        .headers(mapOf(
            "x-am-response-case" to "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        )),
)

multiple database entry

Master save with multy data[with help of schema configuration]
let masterSave = await g.sys.db.masterSave({
    instance: "mysql_8", database: "inventory", collection: "customers",
    saveData: {
        "city_name": "Wembley", //city_name save in mysql database
        "state_id": {
            "state_name": "London", //state_name save in maria database
            "country_id": {
                "country_name":"UK" //country_name save in postGreSql database
            }
        }
    },
    headers: {
        "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
});
Master save with multy data[with help of schema configuration]
master_save = await g.sys.db.master_save(
    'mysql_8', 'inventory', 'customers',
    {
        'city_name': 'Wembley',  # city_name save in mysql database
        'state_id': {
            'state_name': 'London',  # state_name save in maria database
            'country_id': {
                'country_name': 'UK',  # country_name save in postGreSql database
            },
        },
    },
    headers={
        'x-am-response-case': 'capitalCase',  # noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
)
Master save with multy data[with help of schema configuration]
$masterSave = $g->sys->db->masterSave(
    'mysql_8', 'inventory', 'customers',
    [
        'city_name' => 'Wembley', // city_name save in mysql database
        'state_id' => [
            'state_name' => 'London', // state_name save in maria database
            'country_id' => [
                'country_name' => 'UK', // country_name save in postGreSql database
            ],
        ],
    ],
    headers: [
        'x-am-response-case' => 'capitalCase', // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    ],
);
Master save with multy data[with help of schema configuration]
var masterSave = await g.Sys.Db.MasterSave(new Save("mysql_8", "inventory", "customers", new JsonObject
{
    ["city_name"] = "Wembley", // city_name save in mysql database
    ["state_id"] = new JsonObject
    {
        ["state_name"] = "London", // state_name save in maria database
        ["country_id"] = new JsonObject
        {
            ["country_name"] = "UK", // country_name save in postGreSql database
        },
    },
})
{
    Headers = new JsonObject
    {
        ["x-am-response-case"] = "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
});
Master save with multy data[with help of schema configuration]
masterSave, err := g.Sys.Db.MasterSave(am.Save{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    SaveData: am.M{
        "city_name": "Wembley", // city_name save in mysql database
        "state_id": am.M{
            "state_name": "London", // state_name save in maria database
            "country_id": am.M{
                "country_name": "UK", // country_name save in postGreSql database
            },
        },
    },
    Headers: am.M{
        "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
})
if err != nil {
    return nil, err
}
Master save with multy data[with help of schema configuration]
let master_save = g.sys.db.master_save(
    Save::new("mysql_8", "inventory", "customers", json!({
        "city_name": "Wembley", // city_name save in mysql database
        "state_id": {
            "state_name": "London", // state_name save in maria database
            "country_id": {
                "country_name": "UK", // country_name save in postGreSql database
            },
        },
    }))
        .headers(json!({
            "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        })),
)?;
Master save with multy data[with help of schema configuration]
var masterSave = g.sys.db.masterSave(new Save("mysql_8", "inventory", "customers", Map.of(
    "city_name", "Wembley", // city_name save in mysql database
    "state_id", Map.of(
        "state_name", "London", // state_name save in maria database
        "country_id", Map.of(
            "country_name", "UK" // country_name save in postGreSql database
        )
    )
))
    .headers(Map.of(
        "x-am-response-case", "capitalCase" // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    )));
Master save with multy data[with help of schema configuration]
val masterSave = g.sys.db.masterSave(
    Save("mysql_8", "inventory", "customers", mapOf(
        "city_name" to "Wembley", // city_name save in mysql database
        "state_id" to mapOf(
            "state_name" to "London", // state_name save in maria database
            "country_id" to mapOf(
                "country_name" to "UK", // country_name save in postGreSql database
            ),
        ),
    ))
        .headers(mapOf(
            "x-am-response-case" to "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        )),
)

multiple database multiple entry

Master save with multy data[with help of schema configuration]
let masterSave = await g.sys.db.masterSave({
    instance: "mysql_8", database: "inventory", collection: "customers",
    saveData: [{
        "city_name": "Wembley",
        "state_id": {
            "state_name": "London",
            "country_id": 302
        }
    },
    {
        "city_name": "Buffalo",
        "state_id": {
            "state_name": "Chicago",
            "country_id": 303
        }
    }],
    headers: {
        "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
});
Master save with multy data[with help of schema configuration]
master_save = await g.sys.db.master_save(
    'mysql_8', 'inventory', 'customers',
    [
        {
            'city_name': 'Wembley',
            'state_id': {
                'state_name': 'London',
                'country_id': 302,
            },
        },
        {
            'city_name': 'Buffalo',
            'state_id': {
                'state_name': 'Chicago',
                'country_id': 303,
            },
        },
    ],
    headers={
        'x-am-response-case': 'capitalCase',  # noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
)
Master save with multy data[with help of schema configuration]
$masterSave = $g->sys->db->masterSave(
    'mysql_8', 'inventory', 'customers',
    [
        [
            'city_name' => 'Wembley',
            'state_id' => [
                'state_name' => 'London',
                'country_id' => 302,
            ],
        ],
        [
            'city_name' => 'Buffalo',
            'state_id' => [
                'state_name' => 'Chicago',
                'country_id' => 303,
            ],
        ],
    ],
    headers: [
        'x-am-response-case' => 'capitalCase', // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    ],
);
Master save with multy data[with help of schema configuration]
var masterSave = await g.Sys.Db.MasterSave(new Save("mysql_8", "inventory", "customers", new JsonArray
{
    new JsonObject
    {
        ["city_name"] = "Wembley",
        ["state_id"] = new JsonObject
        {
            ["state_name"] = "London",
            ["country_id"] = 302,
        },
    },
    new JsonObject
    {
        ["city_name"] = "Buffalo",
        ["state_id"] = new JsonObject
        {
            ["state_name"] = "Chicago",
            ["country_id"] = 303,
        },
    },
})
{
    Headers = new JsonObject
    {
        ["x-am-response-case"] = "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
});
Master save with multy data[with help of schema configuration]
masterSave, err := g.Sys.Db.MasterSave(am.Save{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    SaveData: []any{
        am.M{
            "city_name": "Wembley",
            "state_id": am.M{
                "state_name": "London",
                "country_id": 302,
            },
        },
        am.M{
            "city_name": "Buffalo",
            "state_id": am.M{
                "state_name": "Chicago",
                "country_id": 303,
            },
        },
    },
    Headers: am.M{
        "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
})
if err != nil {
    return nil, err
}
Master save with multy data[with help of schema configuration]
let master_save = g.sys.db.master_save(
    Save::new("mysql_8", "inventory", "customers", json!([
        {
            "city_name": "Wembley",
            "state_id": {
                "state_name": "London",
                "country_id": 302,
            },
        },
        {
            "city_name": "Buffalo",
            "state_id": {
                "state_name": "Chicago",
                "country_id": 303,
            },
        },
    ]))
        .headers(json!({
            "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        })),
)?;
Master save with multy data[with help of schema configuration]
var masterSave = g.sys.db.masterSave(new Save("mysql_8", "inventory", "customers", List.of(
    Map.of(
        "city_name", "Wembley",
        "state_id", Map.of(
            "state_name", "London",
            "country_id", 302
        )
    ),
    Map.of(
        "city_name", "Buffalo",
        "state_id", Map.of(
            "state_name", "Chicago",
            "country_id", 303
        )
    )
))
    .headers(Map.of(
        "x-am-response-case", "capitalCase" // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    )));
Master save with multy data[with help of schema configuration]
val masterSave = g.sys.db.masterSave(
    Save("mysql_8", "inventory", "customers", listOf(
        mapOf(
            "city_name" to "Wembley",
            "state_id" to mapOf(
                "state_name" to "London",
                "country_id" to 302,
            ),
        ),
        mapOf(
            "city_name" to "Buffalo",
            "state_id" to mapOf(
                "state_name" to "Chicago",
                "country_id" to 303,
            ),
        ),
    ))
        .headers(mapOf(
            "x-am-response-case" to "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        )),
)

Structure

Master save
let masterSave = await g.sys.db.masterSave({
    instance: "INSTANCE_NAME", database: 'DB_NAME', collection: "COLLECTION_NAME",
    saveData: {
        "COLUMN_NAME": "VALUE",
        "COLUMN_NAME2": "VALUE",
    },
    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-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
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        "x-am-tenant-username": "TENANT_USERNAME", // ex: acme
        // 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",
    },
});
Master save
master_save = await g.sys.db.master_save(
    'INSTANCE_NAME', 'DB_NAME', 'COLLECTION_NAME',
    {
        'COLUMN_NAME': 'VALUE',
        'COLUMN_NAME2': 'VALUE',
    },
    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-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
        # Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        'x-am-tenant-username': 'TENANT_USERNAME',  # ex: acme
        # 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',
    },
)
Master save
$masterSave = $g->sys->db->masterSave(
    'INSTANCE_NAME', 'DB_NAME', 'COLLECTION_NAME',
    [
        'COLUMN_NAME' => 'VALUE',
        'COLUMN_NAME2' => 'VALUE',
    ],
    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-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
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        'x-am-tenant-username' => 'TENANT_USERNAME', // ex: acme
        // 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',
    ],
);
Master save
var masterSave = await g.Sys.Db.MasterSave(new Save("INSTANCE_NAME", "DB_NAME", "COLLECTION_NAME", new JsonObject
{
    ["COLUMN_NAME"] = "VALUE",
    ["COLUMN_NAME2"] = "VALUE",
})
{
    Headers = new JsonObject
    {
        ["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-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
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        ["x-am-tenant-username"] = "TENANT_USERNAME", // ex: acme
        // 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",
    },
});
Master save
masterSave, err := g.Sys.Db.MasterSave(am.Save{
    Instance: "INSTANCE_NAME", Database: "DB_NAME", Collection: "COLLECTION_NAME",
    SaveData: am.M{
        "COLUMN_NAME":  "VALUE",
        "COLUMN_NAME2": "VALUE",
    },
    Headers: am.M{
        "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-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
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        "x-am-tenant-username": "TENANT_USERNAME", // ex: acme
        // 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",
    },
})
if err != nil {
    return nil, err
}
Master save
let master_save = g.sys.db.master_save(
    Save::new("INSTANCE_NAME", "DB_NAME", "COLLECTION_NAME", json!({
        "COLUMN_NAME": "VALUE",
        "COLUMN_NAME2": "VALUE",
    }))
        .headers(json!({
            "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-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
            // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
            "x-am-tenant-username": "TENANT_USERNAME", // ex: acme
            // 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",
        })),
)?;
Master save
var masterSave = g.sys.db.masterSave(new Save("INSTANCE_NAME", "DB_NAME", "COLLECTION_NAME", Map.of(
    "COLUMN_NAME", "VALUE",
    "COLUMN_NAME2", "VALUE"
))
    .headers(JsonObject.of(
        "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-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
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        "x-am-tenant-username", "TENANT_USERNAME", // ex: acme
        // 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"
    )));
Master save
val masterSave = g.sys.db.masterSave(
    Save("INSTANCE_NAME", "DB_NAME", "COLLECTION_NAME", mapOf(
        "COLUMN_NAME" to "VALUE",
        "COLUMN_NAME2" to "VALUE",
    ))
        .headers(mapOf(
            "x-am-response-case" to "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
            "x-am-response-object-type" to "make_flat", // no_action | make_flat
            "x-am-meta" to "true", // true, false
            "x-am-internationalization" to "USER_I18N_ID",
            "x-am-run-in-sandbox" to "2",
            "x-am-content-type-response" to "text/xml", // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
            "x-am-cache-control" to "reset_cache", // no_action | reset_cache
            "x-am-get-encrypted-data" to "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
            "x-am-sandbox-timeout" to "13000",
            "x-no-compression" to "true", // true | false
            "x-am-encrypted-payload" to "true", // user will send 'true', when payload is encrypted for transfer
            // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
            "x-am-tenant-username" to "TENANT_USERNAME", // ex: acme
            // Authorization headers
            "x-am-authorization" to "AUTHORIZATION_TOKEN",
            "x-am-user-authorization" to "API_USER_TOKEN",
            "x-aws-authorization" to "AWS_TOKEN",
            "x-google-authorization" to "GOOGLE_TOKEN",
            "x-azure-authorization" to "AZURE_TOKEN",
        )),
)

Multi-tenant

  • instance: "crm::acme" works on the database of the tenant acme of the multi-tenant instance crm.
  • With instance: "crm", the call works on the database of the tenant of the request: a custom API called with the x-am-tenant-username header passes it on to the APIs it calls. A request without a tenant works on the structure database.
Master save a customer of the tenant acme
1
2
3
4
5
6
7
let masterSave = await g.sys.db.masterSave({
    instance: "crm::acme", database: "crm", collection: "customers",
    saveData: {
        "first_name": "Bob",
        "last_name": "Lin"
    }
});
Master save a customer of the tenant acme
1
2
3
4
5
6
7
master_save = await g.sys.db.master_save(
    'crm::acme', 'crm', 'customers',
    {
        'first_name': 'Bob',
        'last_name': 'Lin',
    },
)
Master save a customer of the tenant acme
1
2
3
4
5
6
7
$masterSave = $g->sys->db->masterSave(
    'crm::acme', 'crm', 'customers',
    [
        'first_name' => 'Bob',
        'last_name' => 'Lin',
    ],
);
Master save a customer of the tenant acme
1
2
3
4
5
var masterSave = await g.Sys.Db.MasterSave(new Save("crm::acme", "crm", "customers", new JsonObject
{
    ["first_name"] = "Bob",
    ["last_name"] = "Lin",
}));
Master save a customer of the tenant acme
masterSave, err := g.Sys.Db.MasterSave(am.Save{
    Instance: "crm::acme", Database: "crm", Collection: "customers",
    SaveData: am.M{
        "first_name": "Bob",
        "last_name":  "Lin",
    },
})
if err != nil {
    return nil, err
}
Master save a customer of the tenant acme
1
2
3
4
5
6
let master_save = g.sys.db.master_save(
    Save::new("crm::acme", "crm", "customers", json!({
        "first_name": "Bob",
        "last_name": "Lin",
    })),
)?;
Master save a customer of the tenant acme
1
2
3
4
var masterSave = g.sys.db.masterSave(new Save("crm::acme", "crm", "customers", Map.of(
    "first_name", "Bob",
    "last_name", "Lin"
)));
Master save a customer of the tenant acme
1
2
3
4
5
6
val masterSave = g.sys.db.masterSave(
    Save("crm::acme", "crm", "customers", mapOf(
        "first_name" to "Bob",
        "last_name" to "Lin",
    )),
)

Without a schema

g.sys.db.gen.masterSaveGen takes the same arguments and calls the master save generated API : no schema, so the data is read and written as it is in the table, without the conversions, validations and defaults of the schema.

Language The call
TypeScript g.sys.db.gen.masterSaveGen(…)
Python g.sys.db.gen.master_save_gen(…)
PHP $g->sys->db->gen->masterSaveGen(…)
C#, Go g.Sys.Db.Gen.MasterSaveGen(…)
Rust g.sys.db.master_save_gen(Save::new(…))
Java, Kotlin g.sys.db.gen.masterSaveGen(…)