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.
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, };