Training Day

FileMaker APIs

Overview of FileMaker's Data API and OData API for JSON-based data access

FileMaker Data APIs: When to use them?

Think of FileMaker's APIs as bridges that connect your database to the outside world. They're perfect when you need to:

  • Connect Other Applications: Let external systems talk to your FileMaker database
  • Build Web Apps: Create web interfaces that interact with your FileMaker data
  • Use Any Programming Language: Work with FileMaker from any language that speaks HTTP

What Makes It Special?

  • RESTful Design: Uses familiar web standards
  • JSON Format: Easy to read and work with
  • Container Support: Handle files and images
  • Script Execution: Run FileMaker scripts remotely
  • Batch Operations: Work with multiple records at once

Example: Creating a Customer Record

Here's a real-world example of creating a customer record:

// Request
POST /fmi/data/v1/databases/MyDB/layouts/Customers/records
{
  "fieldData": {
    "FirstName": "John",
    "LastName": "Doe",
    "Email": "john@example.com"
  }
}
 
// Response
{
  "response": {
    "modId": "1",
    "recordId": "1"
  },
  "messages": [
    {
      "code": "0",
      "message": "OK"
    }
  ]
}

Finding Records: A Common Task

When working with APIs, finding records is one of the most common operations. Here's how it works:

// Request
POST /fmi/data/v1/databases/MyDB/layouts/Customers/_find
{
  "query": [
    {
      "LastName": "Doe",
      "FirstName": "John"
    }
  ]
}
 
// Response
{
  "response": {
    "dataInfo": {
      "foundCount": 1,
      "returnedCount": 1
    },
    "data": [
      {
        "fieldData": {
          "FirstName": "John",
          "LastName": "Doe",
          "Email": "john@example.com"
        },
        "recordId": "1",
        "modId": "1"
      }
    ]
  }
}

OData API: Enterprise Integration Made Easy

The OData API is like a universal translator for your data. It's perfect when you need to integrate with enterprise systems or work with standard tools.

Why Choose OData?

  • Standard Protocol: Works with many enterprise tools
  • Powerful Queries: Filter, sort, and expand data
  • Metadata Support: Understand your data structure
  • Batch Operations: Handle multiple records efficiently

Real-World Example: Finding Customers

Here's how you might query customers in a real application:

GET /fmi/odata/v1/MyDB/Customers?$filter=LastName eq 'Doe'&$select=FirstName,LastName,Email
// Response
{
  "@odata.context": "http://localhost/fmi/odata/v1/MyDB/$metadata#Customers",
  "value": [
    {
      "FirstName": "John",
      "LastName": "Doe",
      "Email": "john@example.com"
    }
  ]
}

Creating Records with OData

Adding new records is straightforward:

POST /fmi/odata/v1/MyDB/Customers
// Request Body
{
  "FirstName": "John",
  "LastName": "Doe",
  "Email": "john@example.com"
}
 
// Response
{
  "@odata.context": "http://localhost/fmi/odata/v1/MyDB/$metadata#Customers/$entity",
  "FirstName": "John",
  "LastName": "Doe",
  "Email": "john@example.com"
}

Which API Should You Choose?

Let's compare the two APIs to help you make the right choice:

Data API is Best When You Need:

  • FileMaker-specific features
  • Script execution
  • Container field support
  • Custom integration solutions

OData is Best When You Need:

  • Enterprise system integration
  • Standard protocol support
  • Built-in query capabilities
  • Compatibility with existing tools

Resources for Further Learning

Data API Resources

OData Resources