Edit a record

To edit a record, use an HTTP PATCH method with the records API endpoint specifying the database name, layout, and record ID.

HTTP method

PATCH

URL

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

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 editing the record

record-id – the record ID of the record to edit

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 to update. 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.

Only the fields you specify are updated; other fields in the record are not changed. If "{}" is provided as the fieldData value, the target record is not updated.

For example:

Copy

  "fieldData": {
    "First Name": "Joe",
    "deleteRelated": "Orders.3",
    "Date Field": "2029/1/20"
  },
  "portalData": {
    "JobsTable": [
      {
        "recordId": "70"
        "modId": "4"
        "JobsTable::Name": "Contractor" 
      }
    ]
  },
  "options": {
    "entrymode": "script",
    "prohibitmode": "script"
  },
  "dateformats": 2
}

Other optional request body parameters:

  • modId - Specify a modification ID to ensure that you are editing the current version of a record. If the modification ID value does not match the current modification ID value in the database, the record is not changed.

  • options - When writing data, these options control:

    • entrymode - Ignores whether a field's Allow user to override during data entry option for data validation is selected and uses this option instead. The value "script" ignores a field's data validation requirements (so named because scripts ignore these requirements). The value "user" (default) follows a field's validation requirements.

    • prohibitmode - Ignores whether a field's Prohibit modification of value during data entry option for automatic data entry is selected and uses this option instead. The value "script" ignores a field's automatic data entry requirements (so named because scripts ignore these requirements). The value "user" (default) follows a field's automatic data entry requirements.

  • dateformats - Specifies the format of date and timestamp fields. The value is 0 for US formats, 1 for the file locale's formats, or 2 for ISO 8601 formats. If not specified, the default value is 0.

  • script.prerequest, script.presort, script - Runs FileMaker scripts as part of the request. See Run a script with another request.

Response

The response body, and a messages array showing an error code of 0.

For example:

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

See Error responses.

Notes 

  • When you edit records using the FileMaker Data API, field validation is enforced by default (unless overridden by the entrymode option above). If field validation is enforced and the data does not pass validation, you will receive an error message and the record will not be updated.

  • To delete a related record, you can use the deleteRelated syntax.

    For example, to delete a single record with the ID "3" from the related "Orders" table:

    "deleteRelated" : "Orders.3"

    For example, to delete all records with IDs "7" and "9" from the related "Orders" table:

    "deleteRelated" : ["Orders.7", "Orders.9"]