Create a record

To create a record, use an HTTP POST method with the records API endpoint specifying the database name and the layout.

HTTP method

POST

URL

/fmi/data/version/databases/database-name/layouts/layout-name/records

version – the FileMaker Data API version requested can use v1, v2, or vLatest

database-name – the name of the hosted database

layout-name – the name of the layout to use as the context for creating the record

HTTP header

Content-Type: application/json

Authorization: Bearer session-token, where session-token is the unique X-FM-Data-Access-Token value for the database session

Parameters

Record data in JSON format containing field-and-value pairs that specify values for fields that are in the target layout. The data may specify related records or portals that are on the layout by using the portalData specification. A portal name can be either the object name shown in the Inspector in FileMaker Pro or the related table name.

For example:

Copy
{"fieldData":
  { 
    "String Field": "value_1"
    "Number Field": 99.99
    "repetitionField(1)" : "fieldValue" 
  } 
}

Note   To create an empty record with default values for each field, specify an empty data object in JSON format as the parameter.

For example:

Copy
{"fieldData"
  { 
  } 
}
You can run FileMaker scripts as part of this request by including the script.prerequest, script.presort, and script parameters in the request body. See Run FileMaker scripts.
Response

The record ID of the record that was created, and a messages array showing an error code of 0.

For example:

Copy
{
    "response": { 
        "recordId":"147"
        "modId":"0"
    },
    "messages": [ 
        {
            "code": "0",
            "message":"OK"
        }
    ]
}

See Error responses.

Notes 

  • When you create records using the FileMaker Data API, field validation is enforced. If the data does not pass field validation, you will receive an error message and the record will not be created.