Connect to Claris FileMaker Server from Xojo via Data API
With MBS Xojo Plugins 20.4 we include a new MBS Xojo FMAPI Plugin part with a few new classes to connect to a Claris FileMaker Server:
- class FMAdminMBS
- class FMDataMBS
- class FMConnectionMBS
- class FMDataSourceMBS
- class FMRequestMBS
- class FMResponseMBS
- class FMContainerUploadMBS
The FMDataMBS class does a Data API connection while the FMAdminMBS class provides methods for the Admin API. Both have FMConnectionMBS as base class for the core functionality to connect.
Connect
Lets connect to a server via Data API using user name and password:
To learn what databases are available, please use ListDatabases method in FMAdminMBS class.
Create Record
Next you may want to create a new record. For this we provide a dictionary with keys and values. The plugin passes data to the server in JSON and you may need to provide values as text or numbers as variants. If you need to upload a file to a container field, please use a second call with UploadToContainerField method later.
We specify the layout to use. This layout defines what fields are available to set. The request may include more parameters like a script to run. But here a simple create record example:
Query Records
To query records, please specify the layout to use as that one defines which fields. With request object you can specify the limit and offset for the query to get paged results. Otherwise the default setting is to return first 50 records.
For a lot of operations, a layout must be specified. The layout defines which fields are available to set or query. Optionally you can specify a script to run before the query to gather the records. e.g. by doing a find operation in the script. You can also run a script to sort and specify in your request which portals to return.
More
Please check our example projects for Data API and Admin API queries. You may write your own server monitoring application using the Admin API.
See also FileMaker 19 Data API Guide and Claris FileMaker 19 Admin API Guide.
For all queries and data transferred, FileMaker Server counts data going out and applies a 2 GB per user and per month limit. As a server has minimum 5 users, you have 120 GB/year or more available.
Please do not hesitate to contact us with your questions.