The Relational Add Table command allows you to create a new User Defined Relational Table.
Arguments
The Relational Add Table command requires the following arguments: Command, Realm, Password, Table Name, Table Type.
api_web?r=myrealm&p=mypass&c=rdbaddtable&table=mytable&table_type=regular
The command is 'rdbaddtable', the realm is 'myrealm' and the password is 'mypass' and the table is 'mytable'. This command results in creation of a new regular table with status of 'pending'. It will have NO foreign key relationship. A foreign key and a unique Id must be added before the table can be activated and used. You must set the Foreign Key after the table is created.
The Relational Add Table command supports the following arguments:
Name |
Req? |
Description |
Argument |
Command |
Yes |
Defines the command to use. |
cmd=rdbaddtable c=rdbaddtable |
Realm |
Yes |
Name of the realm to run the command. This is required, and the command will fail if the realm and password do not match. |
realm=[realm_name] r=[realm_name] |
Password |
Yes |
Authentication code for API access. This is required, and the command will fail if the realm and password do not match. |
pwd=[password] p=[password] |
Relational Table Name |
Yes |
Name of the new relational data table. This is required. Table Name must be unique and have no spaces or special characters such as ^ ? % : | < > , ; & $ + = @ #. |
table=[table_name] |
Description |
A short description of the type of data to store in the table. If not defined, Description will be set to the Relational Table Name. The Description supports all alphanumeric characters as well as space, underscore (_), but no other special characters. |
description=[description] |
|
Table Type |
Yes |
Type of data table to create: Any other type will return an error. * Added in v11. Required as of v13.0.0 |
table_type=[regular, flat, join] |
Clear Data |
Set to allow data to be purged from the table with one command, also known as truncating data, before importing new data. It can only be done during the Import process or via an API command. Clear Data is only available to set at the Table level. It can only be enabled when a Table is created and cannot be reset once a Table is Activated. Clear data is allowed by default when a table is created. |
clear_data=[0,1] DEFAULT==1 |
|
Import |
|
Set to '0' to allow data to be imported into the table. This option can be allowed to initially create the table, and updated later in the UI to prevent the addition of further data. If Import is prevented for a Table, the Table will not appear in the Import wizard in the UI, and Import via API will fail. By default, the table allows data to be imported. |
do_not_import=[0,1] DEFAULT==0 |
Export |
|
Set to '0' to allow data to be exported into a report from the table or column. This option can be reset at any time. If Export is not enabled for a Table, the Table will not appear in the Export wizard in the UI. By default, the table allows data to be exported. |
do_not_export=[0,1] DEFAULT==0 |
Edit Data |
|
By default, the data can be edited. If the table should not allow editing data, set the option to 1. |
do_not_edit_data=[0,1] DEFAULT==0 |
Segment |
|
By default, the data can be used in segmentation rules. If the table should not appear for segmentation, set the option to 1. |
do_not_seg=[0,1] DEFAULT==0 |
Example
Using all commands and arguments (please note the command is wrapped for display purposes only):
api_web?r=myrealm&p=mypass&c=rdbaddtable&table=vehicles&description=cars%20trucks%20boats%20motorcycles%20etc&table_type=regular&clear_data=0&do_not_import=0&do_not_export=1&do_not_edit_data=0&do_not_seg=1
Successful results return:
SUCCESS: Table vehicles created
Results
The Add Relational Table command outputs either a SUCCESS or FAILURE message.
SUCCESS
The Add Relational Table command success message returns the SUCCESS message and includes the name of the new table and the foreign key relationship. The result format is:
SUCCESS: Table [newtablename] created
FAILURE
The Add Relational Table command will fail if a table with the same name already exists or invalid data is defined. The result format is:
FAILURE: Problem creating Custom Relational table [newtablename] [Reason]