A database contains tables.
Request examples
Minimal
{
"action": "createDatabase",
"params": {
"databaseName": "test_db_min"
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}Maximal
{
"api": "db",
"apiVersion": "1.0",
"requestId": "1",
"action": "createDatabase",
"params": {
"databaseName": "test_db_max",
"path": "c:\\"
},
"responseOptions": {
"binaryFormat": "hex",
"dataFormat": "objects",
"numberFormat": "string"
},
"debug": "max",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Response examples
Success
{
"authToken": "replaceWithAuthTokenFromCreateSession",
"result": {
"dataFormat": "objects",
"fields": [
{
"name": "databaseName",
"type": "varchar",
"length": 8192,
"scale": null,
"defaultValue": null,
"nullable": false,
"primaryKey": 0,
"autoValue": "none"
},
{
"name": "path",
"type": "varchar",
"length": 8192,
"scale": null,
"defaultValue": null,
"nullable": false,
"primaryKey": 0,
"autoValue": "none"
},
{
"name": "uid",
"type": "bigint",
"length": null,
"scale": null,
"defaultValue": null,
"nullable": false,
"primaryKey": 0,
"autoValue": "none"
}
],
"data": [
{
"databaseName": "testdatabase",
"path": ".\\testdatabase.dbs\\SQL_SYS",
"uid": 1007
}
]
},
"requestId": "00000010",
"debugInfo": {
"request": {
"authToken": "replaceWithAuthTokenFromCreateSession",
"api": "db",
"action": "createDatabase",
"params": {
"databaseName": "testdatabase",
"path": "."
},
"apiVersion": "1.0",
"requestId": "00000010",
"responseOptions": {
"binaryFormat": "hex",
"dataFormat": "objects",
"numberFormat": "string"
},
"debug": "max"
},
"serverSuppliedValues": {
"databaseName": null,
"ownerName": null
},
"errorData": {
"errorData": null
},
"warnings": []
},
"errorCode": 0,
"errorMessage": ""
}Failure
{
"requestId": "3",
"debugInfo": {
"request": {
"api": "db",
"action": "createDatabase",
"params": {
"databaseName": "test_db_min"
},
"requestId": "3",
"debug": "max",
"authToken": "replaceWithAuthTokenFromCreateSession"
},
"serverSuppliedValues": {
"databaseName": null,
"ownerName": null
},
"errorData": {
"errorData": null
},
"warnings": []
},
"errorCode": 4021,
"errorMessage": "Can't create database",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Request properties ("params")
| Property | Description | Default | Type | Limits (inclusive) |
|---|---|---|---|---|
databaseName |
The You specify this property when you want to use a different database instead of the default. Your session's account must have the appropriate privileges to access the code package. This property is useful because objects, such as tables and code packages, can have the same name in multiple databases. This feature allows you to create multiple environments in the same server and reuse the same JSON actions in each environment. For example, you can create It is an error to set If no default database is specified during |
Defaults to the session's "defaultDatabaseName" property | string | 1 to 64 bytes |
path |
The "path" property is a string that identifies the path of the database folder.
Create the test_db_max.dbs database in the c:\temp\ folder {
"action": "createDatabase",
"params": {
"databaseName": "test_db_max",
"path": "c:\\temp"
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}
"path" omitted or set to null If the FairCom server is installed in the C:\FairCom\FairCom-Edge.windows.64bit.v4.5.1.170\ folder, this code example creates the test3.dbs database in C:\FairCom\FairCom-Edge.windows.64bit.v4.5.1.170\data\. {
"action": "createDatabase",
"params": {
"databaseName": "test3"
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Forward slash {
"action": "createDatabase",
"params": {
"databaseName": "test4",
"path": "c:/temp"
},
"authToken": "replaceWithAuthTokenFromCreateSession"
} |
"" | string | 0 to 2,048 bytes |
Response properties ("result")
| Property | Description | Type | Limits (inclusive) |
|---|---|---|---|
data |
The "data" property specifies an array or object that the server returns, such as records returned by a query. It is an empty array when no results are available. |
array | Its contents are determined by the action |
|
data .databaseName |
The
"data": [ |
string | 1 to 64 bytes |
|
data .path |
The "path" property specifies the directory path to the specified database. |
string | 0 to 2,048 bytes |
|
data .uid |
The "uid" property specifies the unique id of the database. |
integer | No limit |
dataFormat |
The
|
string |
"autoDetect""arrays""objects"
|
fields |
The "fields" property specifies an array of objects set by the server, where each object is the definition of a field in a table defining the details of each field returned by a query. |
array |
|
|
fields .autoValue |
The "autoValue" property specifies when and how the server automatically sets the field value. See for more details. |
string |
"none""incrementOnInsert""timestampOnInser""timestampOnUpdate""timestampOnUpdateAndInsert""changeid"
|
|
fields .defaultValue |
The "defaultValue" property identifies the default value of the field. |
string | 0 to 65,500 bytes |
|
fields .length |
The "length" property specifies the length of a field's value in a record. |
integer |
1 to 65500
|
|
fields .name |
The "name" property specifies the new name of the field. |
string | 0 to 64 bytes |
|
fields .nullable |
The "nullable" property allows a field to contain a NULL value when true. |
Boolean |
truefalse
|
|
fields .primaryKey |
The "primaryKey" property adds a field to the specified ordinal position of the table's primary key when > 0. |
integer |
0 to 32
|
|
fields .scale |
The "scale" property specifies the number of places to the right of the decimal point for "number" and "money" type fields. |
integer |
0 to 32
|
|
fields .type |
The "type" property specifies the type of field. See Data types for more details. |
string |
"bit""tinyint""smallint""integer""bigint""real""float""number""money""date""time""timestamp""char""varchar""lvarchar""binary""varbinary""lvarbinary""json"
|