REST API Integrations with Parameters and Variables (v8.241112)
A minor release that gives FPL full control over REST API calls — method, path, headers, parameters and form encoding — with secrets kept as variables on the integration. It also fixes the Webhook data source and adds a security token to it. The release rolled out to all instances the week of November 18, 2024.
Changes
REST API integrations
- Calls are defined in FPL. A
Platform_REST_Callcan set the request's method, path, encoding, headers and parameters itself, so the integration only needs the site's address and any variables. - Variables keep secrets out of the code. Values such as a client ID or client secret are stored as variables on the integration and referenced by name. The value is not shown to users who read or edit the FPL.
- Form encoding.
encoding: "form"sends the parameters asapplication/x-www-form-urlencoded, which most OAuth token endpoints require. TheContent-Typeheader does not need to be set separately.
A token request followed by an API call, using an integration named boxAPI that holds CLIENT_ID, CLIENT_SECRET and ENTERPRISE_ID as variables:
let response = Platform_REST_Call("boxAPI", {
method: "POST",
encoding: "form",
paras: [
{name: "client_id", variable: "CLIENT_ID"},
{name: "client_secret", variable: "CLIENT_SECRET"},
{name: "grant_type", value: "client_credentials"},
{name: "box_subject_type", value: "enterprise"},
{name: "box_subject_id", variable: "ENTERPRISE_ID"}
]
})
let result = Platform_REST_Call("boxAPI", {
method: "GET",
path: "/2.0/events",
encoding: "url",
headers: [
{header: "authorization", value: sprintf("Bearer %s", response.data.access_token)}
],
paras: [
{name: "stream_type", value: "admin_logs_streaming"}
]
})
The Box integration is built this way.
Webhook data source
- A Webhook data source can require a security token.
- Fixed the URL shown for a Webhook data source in tenant mode.
- Fixed the S3 upload path used by Webhook data sources.
See Webhooks.
Platform API and FPL
- New
set_site_nameAPI. Platform_Site_GetInforeturns the site'sdisplayName.