Using the Ontology SDK (OSDK) in Slate

Beta

OSDK in Slate is in a Beta state, and some functionality may change before the product is generally available. OSDK in Slate may not be available on all enrollments.

The Ontology Software Development Kit (OSDK) allows builders to leverage the full power of the Ontology within the Slate code environment. The OSDK is accessible as a Library within the Functions Editor tab.

Getting started

  • Navigate to the Functions editor. You will find Libraries in the lower left pane.
  • Select the Ontology SDK (OSDK) to see detailed configuration options.
  • First, choose the ontology you want to access. Note that you may only have one ontology, depending on your platform setup or permissions.
  • Select the object types, link types, and actions you want to bring into your Slate application.
  • Click on + Get Started to open a new function, which will include a code snippet to access the selected object type.

Using OSDK with Slate Functions

The Functions editor is where you can access and transform data fetched via the OSDK. Use the following code snippet to import the object types you want to work with:

Copied!
1 import {client} from "@slate/osdk";

Example JavaScript code demonstrating how to use the OSDK in a Slate function to fetch 10 objects for a table widget:

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 import { client } from "@slate/osdk"; const driverResponse = await client.ontology.objects.F1Driver.fetchPage({ pageSize: 10 }); if (driverResponse.type === "error") { return { driverNames: [], driverIds: [], }; } const driverNames = driverResponse.data.map(driver => `${driver.forename} ${driver.surname}`); const driverIds = driverResponse.data.map(driver => driver.driverId); return { driverNames, driverIds, };