Custom Object Schema
Endpoints for managing custom object table schemas: creating and removing tables, and adding, updating, and removing their columns. Custom tables extend the built-in object model with user-defined structures.
Get object metadata
Returns the schema metadata of all object tables (both built-in and custom), including field types, constraints, and join relationships.
POST /object_metadata.fcgi
Parameters
- filter (string): Optional. Filters which tables to return. Values:
"custom"(only custom tables),"default"(only built-in tables). If omitted, all tables are returned.
Response
Object where each key is a table name and each value is an object with:
- fields (object): Map of field name → field descriptor:
- type (string): Data type (
"INTEGER","BIGINT","TEXT","BLOB"). - primary key (bool): Whether the field is a primary key.
- not null (bool): Whether the field has a NOT NULL constraint.
- default value (string): Default value, if any.
- unique (bool): Whether the field has a UNIQUE constraint.
- foreign key (object): Present only if the field is a foreign key. Contains:
- object (string): Referenced table name.
- field (string): Referenced field name.
- type (string): Data type (
- joins (object): Map of join name → array of
{ "object", "field" }references.
Request example
$.ajax({
url: "/object_metadata.fcgi?session=" + session,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
"filter": "custom"
})
});
Response example
{
"custom_departments": {
"fields": {
"id": { "type": "INTEGER", "primary key": true, "not null": true, "default value": "", "unique": false },
"name": { "type": "TEXT", "primary key": false, "not null": false, "default value": "", "unique": false }
},
"joins": {}
}
}
Add custom table
Creates a new custom object table with an initial set of columns.
POST /object_add.fcgi
Parameters
- object (string): Required. Internal table name (used as identifier and SQL table name).
- name (string): Required. Display label for the table.
- id (int): Optional. Custom ID for the table. Auto-assigned if omitted.
- fields (array of objects): Required. At least one field must be provided. Each field contains:
- column_name (string): Required. Internal column name.
- name (string): Required. Display label for the column.
- type (string): Required. Data type:
"INTEGER","BIGINT","TEXT", or"BLOB". - constraint (string): Optional. Values:
"NONE"(default) or"NOT_NULL". - unique (bool): Optional. Default
false. - foreign_key (object): Optional. Foreign key reference:
- object (string): Referenced table name.
- field (string): Referenced field name.
Response
- ids (array of int): Array containing the ID of the newly created table.
Request example
$.ajax({
url: "/object_add.fcgi?session=" + session,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
"object": "custom_departments",
"name": "Departments",
"fields": [
{ "column_name": "name", "name": "Name", "type": "TEXT" },
{
"column_name": "user_id",
"name": "User",
"type": "INTEGER",
"constraint": "NOT_NULL",
"foreign_key": { "object": "users", "field": "id" }
}
]
})
});
Response example
{
"ids": [5]
}
Remove custom tables
Removes one or more custom tables by their IDs.
POST /object_remove.fcgi
Parameters
- ids (array of int): Required. IDs of the custom tables to remove.
Response
- This call has no return.
Request example
$.ajax({
url: "/object_remove.fcgi?session=" + session,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
"ids": [5]
})
});
Add field to custom table
Adds a new column to an existing custom table.
POST /object_add_field.fcgi
Parameters
- object (string): Required. Name of the custom table to add the column to.
- column_name (string): Required. Internal column name.
- name (string): Required. Display label for the column.
- type (string): Required. Data type:
"INTEGER","BIGINT","TEXT", or"BLOB". - constraint (string): Optional. Values:
"NONE"(default) or"NOT_NULL". - unique (bool): Optional. Default
false. - default_value (varies): Required when
constraintis"NOT_NULL". Type must match the field type. - foreign_key (object): Optional. Foreign key reference:
- object (string): Referenced table name.
- field (string): Referenced field name.
Response
- ids (array of int): Array containing the ID of the newly created column.
Request example
$.ajax({
url: "/object_add_field.fcgi?session=" + session,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
"object": "custom_departments",
"column_name": "description",
"name": "Description",
"type": "TEXT"
})
});
Response example
{
"ids": [12]
}
Remove fields from custom table
Removes one or more columns from a custom table by their IDs.
POST /object_remove_fields.fcgi
Parameters
- ids (array of int): Required. IDs of the columns to remove.
Response
- ids (array of int): IDs of the removed columns.
Request example
$.ajax({
url: "/object_remove_fields.fcgi?session=" + session,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
"ids": [12]
})
});
Update field in custom table
Updates the definition of an existing column in a custom table.
POST /object_update_field.fcgi
Parameters
- id (int): Required. ID of the column to update.
- column_name (string): Required. New internal column name.
- type (string): Required. Data type:
"INTEGER","BIGINT","TEXT", or"BLOB". - constraint (string): Required. Values:
"NONE"or"NOT_NULL". - name (string): Optional. New display label.
- unique (bool): Optional. Set unique constraint.
- default_value (varies): Required when
uniqueis being set. Type must match the field type. - foreign_key (object): Optional. Foreign key reference:
- object (string): Referenced table name.
- field (string): Referenced field name.
Response
- This call has no return.
Request example
$.ajax({
url: "/object_update_field.fcgi?session=" + session,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
"id": 12,
"column_name": "description",
"type": "TEXT",
"constraint": "NONE",
"name": "Full Description"
})
});