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