Interpreting and handling Data API error codes
IntermediateUnderstand how the Data API reports errors through the messages array, recognize the most common error codes, and handle them gracefully in FileMaker scripts.
What you'll learn
- How error information is structured in the Data API response
- The most common error codes and what they mean
- How to translate error codes into user-friendly messages inside a FileMaker script
The Data API always returns a messages array — even on success. The code field in that array is the definitive indicator of what happened, and your scripts must check it, not just the HTTP status code.
1/3
1
Read the messages array from every response
Every Data API response contains a messages array. Code "0" means success. Any other code is an error. Always extract and check this value.
FileMaker Script
Set Variable [ $code ; Value: JSONGetElement ( $response ; "messages[0].code" ) ] Set Variable [ $message ; Value: JSONGetElement ( $response ; "messages[0].message" ) ] If [ $code ≠ "0" ] Exit Script [ Result: "api-error:" & $code & " — " & $message ] End If
Including portal records in Data API responsesUploading a file to a container field via the Data API
Sign in to track your progress and pick up where you left off.
Sign in to FM Dojo