tried the FileMaker 17 Data API from the terminal

Hello.
I am Teruhiro Komaki of frudens Inc.

The other day, FileMaker 17 has been released, the neighborhood is very exciting.
Many developers write articles related to 17.
Therefore, I will write about FileMaker 17 Data API with less information this time.

As the title suggests, I use a terminal but I try to use it with Copy, so feel free to try it.

First of all, about the document.

About the FileMaker Data API

The FileMaker Data API was available from 16, but it was a trial period.
The trial period ended at 17 and it was officially released.

If you have time, please see the help.

FileMaker 16 Data API
https://fmhelp.filemaker.com/docs/16/en/restapi/

FileMaker 17 Data API
https://fmhelp.filemaker.com/docs/17/en/dataapi/

About FileMaker Data API Reference

After installing FileMaker Server, you can see the reference at the following URL.

https://your-domain.com/fmi/data/apidoc/

If you look at help it is properly written, so let’s see.

When you installed FileMaker Server, you installed the FileMaker Data API reference files. This reference provides detailed information about all of the calls supported by the FileMaker Data API.

Note:To view the reference information, check that FileMaker Data API access has been enabled in Admin Console. See FileMaker Server Help.

  • To view the reference in a browser window on the master machine, enter the URL
    https://localhost/fmi/data/apidoc/
  • To view the reference in a browser window on a remote machine, enter the URL
    https://host/fmi/data/apidoc/
    where host is the IP address or host name of the master machine running FileMaker Server.
  • On a Windows server, the reference files are in the folder

    [drive]:\Program Files\FileMaker\FileMaker Server\Documentation\Data API Documentation
    where [drive] is the drive on which your FileMaker Server deployment resides.

    If you install using a non-default location on Windows, your installation location replaces the beginning of the default installation path
    [drive]:[installation_location]\FileMaker\FileMaker Server\Documentation\Data API Documentation
  • On a macOS server, the reference files are in the folder
    /Library/FileMaker Server/Documentation/Data API Documentation

Notes

The reference files show variables in the URLs by using a keyword preceded by a colon (:). For example: :database
This guide shows variables in the URLs by using an italic font. For example: database-name

Environment

macOS High Sierra (10.13.4)
curl 7.54.0
jq 1.5 (Please install with brew!)

For windows, please do it with cygwin etc.
If I have time, I’ll try to verify.

Retrieve records of arbitrary layout

Write Login and Get Records collectively.

host="your-host.com"
auth=`echo -n "yourAccountName:yourPassword" | base64`
database="yourFileName"
layout="yourLayoutName"
option="?_limit=5"
token=`curl --request POST \
	--header "Content-Type: application/json" \
	--header "Authorization: Basic $auth" \
	--data "{}" \
	https://$host/fmi/data/v1/databases/$database/sessions \
	| jq '.response.token' \
	| sed "s/\"//g"`
curl --request GET \
	--header "Authorization: Bearer $token" \
	https://$host/fmi/data/v1/databases/$database/layouts/$layout/records$option \
	| jq

Pasting this on a terminal should work.
Since we are not worried about any error handling etc., please do not scratch the details.

By the way, you can specify a script as an option.
Is this neighborhood the same as fmp://?

option="?_limit=5&script=testScript"

In this way you can easily check the response.

filemaker-17-data-api-from-terminal1

The image of ↑ contains script end value of testScript.

filemaker-17-data-api-from-terminal2

Afterword

Please note that FileMaker 17 Data API is not free.

I tried it for the time being, but I am exploring how to use it, in various ways!

I am a Japanese developer. (I am studying English.) I met the FileMaker Platform at the company I worked at the time. Develop a custom App as an in-house developer. Acting as freelance from 2014 and establishing frudens Inc. in 2016. Recently, I use 'Insert From URL'. I enjoy FileMaker and various services in Integration!

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.