Use the Ontology SDK (OSDK) in Slate [Beta]

Beta

Ontology SDK in Slate is in the beta phase of development and may not be available on your enrollment. Functionality may change during active development.

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, Action types, and Functions you want to bring into your Slate application.
  • Select + Get Started to open a new function, which will include a code snippet to access the selected object type.

osdk-functions-panel

Use OSDK with Slate Functions

The Functions editor is where you can access and transform data fetched through 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 19 20 21 22 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, };