Log in to an external data source

If your hosted database needs to log in to an external data source, the hosted database name is specified in the URL; the account name and password for the hosted database are specified in a header Authorization string; and the database name, account name, and password for the external data source are specified in the fmDataSource parameter as a JSON array.

For a database hosted on the Claris platform, use the extended Claris account name and password you set in Claris Studio. See “Create an extended Claris account for Claris Server services” in Claris Studio Help Center.

HTTP method

POST

URL

/fmi/data/version/databases/database-name/sessions

version – the FileMaker Data API version requested can use v1,v2, or vLatest

database-name – the name of the hosted database

HTTP header

Content-Type: application/json

Authorization: a base64-encoded string representing the account name and password to use to log in to the hosted database. This base64-encoded string should follow the standard HTTP Basic Authentication Scheme.

For a database hosted on the Claris platform, use the extended Claris account name and password you set in Claris Studio.

Parameters

The fmDataSource parameter with a JSON array specifying the database name, account name, and password to use for logging in to the external data source.

For example:

Copy
{ "fmDataSource":
  [ { "database":"contacts", "username":"admin", "password":"admin" } ]
}

FileMaker Server only: To use an OAuth account to log in to the external data source, specify the X-FMS-Request-ID header value (oAuthRequestId) and the URL query value (oAuthIdentifier).

Copy
{ "fmDataSource":
  [ { "database":"contacts", "oAuthRequestId": "E65B98BB17429CO643B31119F", "oAuthIdentifier": "B164A3459A776E5177445DR223"} ]
}
Response

The access token, an empty response body, and a messages array showing an error code of 0.

The X-FM-Data-Access-Token header is returned in response, which is the session token to be used for subsequent API calls.

For example:

Copy
X-FM-Data-Access-Token: c13c0f486780f2187bde6f3859dabd4dcf8ea43be420dfeadf34
{
    "response": {},
    "messages":[{"code":"0","message":"OK"}]
}

See Error responses.

Notes 

  • Claris and FileMaker databases are the only external data sources supported. Specify the database name without the extension:

    • For a Filemaker database, remove .fmp12 filename.

    • For a Claris database, remove .claris.

  • Files listed in the fmDataSource parameter will be opened as needed, for example, when a script is run or when the context is changed to a layout that requires the external data source. As a result, errors with logging in to the external data source happen when attempting to open the files, not when logging in to the database session.