How to use 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 API Key
Click the "Create API Key" button in the upper right to create a new 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 API Key
If you have everything correct you will be able to copy the newly created API Key.
Success
You have successfully created an API Key. You can now use this API Key to access the FileMaker Data API.
Using an 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 an 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 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 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 API Key and use it to make a request to the Data API.