FileMaker Data API > Create record and set the primary key

Here is a fun question…

If you use the FileMaker Data API > "Create Record" call…

…and pass in a value for the primary key…into a table where the primary key field is set to Auto-Enter a value…which value “wins"?

  1. The value that you pass in?
  2. The auto enter value?

Test suite:
Pure API call no API scripts involved

Thoughts?

From what I can see, if using the default "PrimaryKey" field, then it has 'Prohibit modification during data entry' enabled, so the Create Record Data API request fails with error 201 'Field cannot be modified'...

However, if the 'Prohibit modification...' option is disabled, then the value sent with the request 'wins', as long as it does not fail due to other reasons such as field validation rules etc...

1 Like

Our testing confirms that you are 100% correct.

{
"messages": [
{
"code": "201",
"message": "Field cannot be modified"
}
],
"response": {}
}

Thank
you.

1 Like