Dataloader WebAPI / Table initialization
Note
This document has been machine translated.
Defines the data_name used by the data loader so that it can save the data. (Initializes the table)
Endpoint
https://<api-server-endpoint>/api/v1/dataloaderapi/jsonrpc
Request example
Below is an example of a request that defines data_name with the name test_event_001 and initializes a table with a string column of up to 256 characters called test_varchar_1.
{
"id": 1,
"jsonrpc": "2.0",
"method": "loaderwebapi.register_loader",
"params": {
"data_name": "test_event_001",
"schema": "event",
"record_def": {
"test_varchar_1": {
"udt_name": "varchar",
"is_nullable": false,
"column_default": "",
"length": 256
}
},
"unique_columns": [
"location",
"start_datetime"
]
}
}
Response example
The following is the return contents in the above request example.
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"schema": "event",
"table_name": "test_event_001"
}
}
Parameters
Among the JSON-RPC request contents, the ones that can be specified in params are displayed below. Those marked Required are required parameters.
data_name: string (Required)- A name that points to the table in which you want to insert the data. The name defined here is also used in init_record and add_record.
schema: string (Optional)- Schema name where the table is created
- Only use it if you know the schema structure of your database and want to specify a table creation schema.
record_def: object (Required)- Key: Attribute name (column name), Value: object representing attribute information
start_datetime(timestamptz),end_datetime(timestamptz),location(geometry) cannot be specified as attribute names because they are created automatically, and an error will occur if specified.- Structure of value object:
udt_name: string (Required)- The type name of the attribute. The values that can be specified will be described later.
is_nullable: bool (Optional,falseif not specified)trueif you allow null values
column_default: string (Optional)- Default value if no attribute value is passed during add_record
length: int (Optional)- Maximum length of storable value (only available for specifiable type names)
srid: int (Optional, available only forgeometrytype,4326if not specified)file_name_column: string (only forfiletype, Required)- The name of the column to save the file name for the file to be saved
- Must be a string definition when specified in record_def.
file_type_column: string (only forfiletype, Required)- The name of the column to save the file type (content-type) for the file to be saved
- Must be a string definition when specified with record_def
file_prefixid_column: string (only forfiletype, Required)- The name of the column that stores the prefix ID for the file to be saved
- Must be an int type definition when specified in record_def
file_pathid_column: string (only forfiletype, Required)- The name of the column to save the path ID for the file to be saved
- Must be a string definition when specified in record_def
file_relativepath_property: string (only forfiletype, Required)- The json key name to send the relative path of the file location to the file to be saved.
- Not specified in record_def, but add_record sometimes requires a relative path to be specified, using the value specified here as the key name under properties
- A type name that can be specified in
udt_name. file, raster and bitmap types need to use base64ized strings when sending using add_record- time type:
timestamptztimestamptimetztimedate
- int type:
int8int4int2
- float type:
float8float4
- string type:
varcharbpchartext
- bool:
bool
- geometry:
geometry
- File (unique type definition for "file reference"):
file
- Others:
rasterbytea
- time type:
unique_columns: string array (Required)- You must define at least one (composite) unique key for better performance.
- You must specify the array using the string contained in the key (and reserved column name) specified in
record_def.
Return values
successful termination:
schema: Schema in which the table was createdtable_name: Real table name
If an error occurs, such as when the initialization process corresponding to data_name has already been performed, error is returned.