Create a table

To create a new table, use the HTTP POST method. The POST body must contain a single valid table representation, which includes an identifier that is the table name.

Component Description

HTTP method

POST

URL

https://host/fmi/odata/version/database-name/FileMaker_Tables

host – FileMaker Cloud or FileMaker Server host name

version – the OData version, always v4

database-name – the name of the hosted database

Example: /fmi/odata/v4/ContactMgmt/FileMaker_Tables

Parameters

JSON example

Copy
{
  "tableName": "Company",
  "fields": [
    {
      "name": "Company ID",
      "type": "int",
      "primary": true
    },
    {
      "name": "User ID",
      "type": "varchar(20)",
      "unique": true,
      "default": "CURRENT_USER"
    },
    {
      "name": "Company Name",
      "type": "varchar(100)",
      "nullable": false
    },
    {
      "name": "Notes",
      "type": "varchar(2000)",
      "global": true
    },
    {
      "name": "Signed Contract",
      "type": "blob",
      "externalSecurePath": "ContactMgmt/"
    }
  ]
}

Atom example:

Copy
<TableDefinition tableName="Company">
  <FieldDefinition name="Company ID" type="int" primary="true"/>
  <FieldDefinition name="User ID" type="varchar(20)" unique="true" default="CURRENT_USER"/>
  <FieldDefinition name="Company Name" type="varchar(100)" nullable="false"/>
  <FieldDefinition name="Notes" type="varchar(2000)" global="true"/>
</TableDefinition>

FileMaker information

  • FileMaker_Tables is a system table used for creating, modifying, and deleting tables. The type parameter is one of the following types: NUMERIC, DECIMAL, INT, DATE, TIME, TIMESTAMP, VARCHAR, CHARACTER VARYING, BLOB, VARBINARY, LONGVARBINARY, or BINARY VARYING.

  • Repetitions are specified in brackets after the type (for example, "INT[4]"). You can specify the maximum length of a text field in parentheses (for example, "VARCHAR(200)").

  • When you create a new table and specify NULL as the default type, the keyword value defaults to TIMESTAMP.

  • Optional parameters are used with the field name and field type:

    • "primary": true or false (whether the field is a primary key; default is false)

    • "unique": true or false (whether the field must have a unique value; default is false)

    • "global": true or false (whether the field is global; default is false)

    • "default": a string containing a keyword that's appropriate for the data type; valid keywords are USER, USERNAME, CURRENT_USER, CURRENT_DATE, CURDATE, CURRENT_TIME, CURTIME, CURRENT_TIMESTAMP, and CURTIMESTAMP

    • "externalSecurePath" (container field only): a string containing a relative path for secure files in "externalSecurePath". Exclude the "[database location]/" portion of the base directory. Be sure to set this for each FileMaker Pro database in FileMaker Pro. See FileMaker Pro Help.