How to use Data API Keys
Introduction
OttoFMS provides an API Key service to make it easier to use the FileMaker Data API by handling the token exchange and refreshing that you need to do to use the Data API. Without OttoFMS you need to login with a user name and password first to get an access token then you can use that token to make calls to the Data API. With OttoFMS you can set up an API Key to access a given file with a user name and password and then use that API Key to make calls to the Data API. OttoFMS will handle the token exchange and refresh for you.
The API Key can be safely given to 3rd party integrations and services to access your FileMaker data without giving them access to your FileMaker username and password.
Before you begin
Before you begin you should check off everything in this list:
- OttoFMS is running on a FileMaker server version 19.6 or later
- The FileMaker Data API is enabled on the server
- The FileMaker File you want to access is hosted on the server
- You have a username and password for the file that has the correct privilege set to access the Data API
- You are be able to make Data API Request the native way without using an API Key.
If you don't have this checklist completed, you may struggle with the steps below.
Create an API Key
Once you sure your server is ready, create an API Key, by following these steps.
Login to OttoFMS
Login to the OttoFMS web console.
Navigate to API Keys
Navigate to the API Keys page in the web console.
Create a new Data API Key
Click the "Create Data API Key" button in the upper right to create a new Data API Key.
Fill out the form
Fill out the form in the modal dialog that pops ups. When you have entered everything correctly click the Create Button. If you have everything configured correctly and you have the right user name and password, you won't get an error.
Copy the Data API Key
If you have everything correct you will be able to copy the newly created Data API Key.
Success
You have successfully created an Data API Key. You can now use this Data API Key to access the FileMaker Data API.
Using a Data API Key to make a Request
Use a different url
Important You will need to use a slightly different url when access the data api with a Data API Key.
Add /otto
just before the /fmi/
segment in any Data API request. This will send the request through OttoFMS and it can use the Data API Key.
For example, change this URL path:
/fmi/data/vLatest/databases/{database.fmp12}/layouts/{layout}/records
to this path
/otto/fmi/data/vLatest/databases/{database.fmp12}/layouts/{layout}/records
File extension matters Always add .fmp12
to the end of the database name
in the url.
Authentication
Pass the Data API Key to the request in one of 2 ways.
- As Bearer Token in an Authorization header, just like you would do with the access token.
- As query parameter
?apiKey={API_KEY}
- as basic auth in the url
https://apiKey:{API_KEY}@your.server.com/otto/fmi/data/vLatest/databases/{database.fmp12}/layouts/{layout}/records
Video
Here is a video that shows how to create an Data API Key and use it to make a request to the Data API.