GraphQL-Like Patterns with the FileMaker Data API
ExpertBuild field selection, nested data requests, and query batching patterns that give the Data API GraphQL-like flexibility without adding a GraphQL layer.
What you'll learn
- How to use dedicated layouts as field selection projections
- How to return nested related data in a single request using portals
- How to batch multiple find operations into one script call
- Trade-offs between layout-per-projection and dynamic field filtering
GraphQL's main value propositions -- field selection, nested resources in one request, and request batching -- can all be approximated with the FileMaker Data API by choosing the right layouts, portal configurations, and script combinations. This avoids adding a GraphQL server while still giving API consumers control over response shape.
Layout-per-projection for field selection
Create multiple layouts over the same table, each exposing a different set of fields. Callers choose the layout corresponding to their field requirements. This eliminates over-fetching without client-side filtering.
// Layout: Contacts_Summary (id, name, email only)
// Layout: Contacts_Full (all fields)
// Layout: Contacts_WithInvoices (fields + Invoices portal)
// Client specifies which projection it needs:
GET /fmi/data/v1/databases/CRM/layouts/Contacts_Summary/records
-> returns only { Name, Email, recordId }
GET /fmi/data/v1/databases/CRM/layouts/Contacts_WithInvoices/records
-> returns contact fields + nested invoice portal rowsSign in to track your progress and pick up where you left off.
Sign in to FM Dojo