Skip to main content

API (v1)

Types

dataField

  • ìd (ID String)
  • name (String)

dataObject

  • name (String): the singular human readable name of the data object type
  • namePlural (String): the plural human readable name of the data object type
  • connectedDatafields: (Datafield) fields the dataset can directly see via a connection
  • dataFrame (JSON): data following the schema of connectedDataFields
  • rid (ID String): the ressource ID representing this dataFrame
  • apiName (String): human readable name of the API. Might be set to a default value when not changed by the user changed by the user changed by the user changed by the user changed by the user changed by the user changed by the user changed by the user
  • objectCount (Int): Number of rows in the dataFrame
  • humanReadableId (String): deprecated
  • userSelectedPrimaryKey (String): the name of the primary dataField used for sorting and filtering
  • userSelectedTitle (String): the name of the dataField representing the title of the ressource, used for sorting, filtering and highlighting titles

dataset

  • ìd (ID String)
  • name (String)

Queries

objectView

objectView returns a data object containing a dataframe with relevant data from datasets, transforms or as the output of AI models.

Returns:

dataObject

Inputs:

  • objectTypeId (ID-String): the ontology object type ID
  • ẁorkshopModuleId (ID-String): the module's ID
Minimal example

Variables

{
"objectTypeId": "9b896e6b-949a-4453-90db-49b06a37fc1b",
"workshopModuleId": "fd623926-e105-4557-b378-a01ade44b277"
}

Query

query objectView($objectTypeId: ID, $workshopModuleId: ID) {
objectView(objectTypeID: $objectTypeId, workshopModuleID: $workshopModuleId) {
name
dataFrame
}
}

Response

{
"data": {
"objectView": {
"name": "AI Generated Image",
"dataFrame": [
{
"style": "https://s3.ohmytofu.ai/dev-tmp-uploads/uploads/a24011ad-04a7-486b-bef8-7382d3f4fa40/empty.png",
"time_created": "2022-12-01T20:53:04.357Z",
"images": [
[
true,
"client-results/7fb73ed1-c952-4349-aa7d-bcd07488c016/20221201215304-4bc05a7a-476045878-1476508276.png"
]
],
"title": "Generated image"
},
{
"style": "https://s3.ohmytofu.ai/dev-tmp-uploads/uploads/a24011ad-04a7-486b-bef8-7382d3f4fa40/empty.png",
"time_created": "2022-12-01T20:52:02.309Z",
"images": [
[
true,
"client-results/9bcb1825-a4ee-43f2-a92a-b666763cdee0/20221201215202-4bc05a7a-1084971013-3415734545.png"
]
],
"title": "Generated image"
},
],
}
}
}
Full example

Variables

{
"objectTypeId": "9b896e6b-949a-4453-90db-49b06a37fc1b",
"workshopModuleId": "fd623926-e105-4557-b378-a01ade44b277"
}

Query

query objectView($objectTypeId: ID, $workshopModuleId: ID) {
objectView(objectTypeID: $objectTypeId, workshopModuleID: $workshopModuleId) {
name
connectedDatafields
dataFrame
apiName
objectCount
namePlural
humanReadableId
userSelectedPrimaryKey
userSelectedTitleKey
apiName
rid
id
icon
iconColor
backingDatasource {
dataFields {
id
databaseFieldName
name
userSelectedType
__typename
}
__typename
}
__typename
}
}

Response

{
"data": {
"objectView": {
"name": "AI Generated Image",
"connectedDatafields": [
{
"id": "f8bbad79-853a-4b0e-82ce-634abf3974af",
"name": "Ttitle",
"databaseFieldName": "title",
"sample": "PÄRUP",
"nodePosition": [
0,
0
],
"userSelectedType": "string",
"type": "datafield"
},
{
"id": "8b9f2f48-4686-4afc-93c3-bacbc4869330",
"name": "Style Class",
"databaseFieldName": "style",
"sample": "2er-Sofa, Vissle dunkelgrün",
"nodePosition": [
513,
170
],
"dataTypeAsArray": null,
"userSelectedType": "string",
"createdAt": null,
"lastUpdatedAt": null,
"type": "datafield"
},
{
"id": "7f6ee0a3-7986-4aa8-b26e-341680e6a842",
"name": "Images",
"databaseFieldName": "images",
"sample": "",
"nodePosition": [
515,
329
],
"dataTypeAsArray": true,
"userSelectedType": "string",
"createdAt": null,
"lastUpdatedAt": null,
"type": "datafield"
}
],
"dataFrame": [
{
"style": "https://s3.ohmytofu.ai/dev-tmp-uploads/uploads/a24011ad-04a7-486b-bef8-7382d3f4fa40/empty.png",
"time_created": "2022-12-01T20:53:04.357Z",
"images": [
[
true,
"client-results/7fb73ed1-c952-4349-aa7d-bcd07488c016/20221201215304-4bc05a7a-476045878-1476508276.png"
]
],
"title": "Generated image"
},
{
"style": "https://s3.ohmytofu.ai/dev-tmp-uploads/uploads/a24011ad-04a7-486b-bef8-7382d3f4fa40/empty.png",
"time_created": "2022-12-01T20:52:02.309Z",
"images": [
[
true,
"client-results/9bcb1825-a4ee-43f2-a92a-b666763cdee0/20221201215202-4bc05a7a-1084971013-3415734545.png"
]
],
"title": "Generated image"
},
],
"namePlural": "AI Generated Images",
"userSelectedPrimaryKey": "8b9f2f48-4686-4afc-93c3-bacbc4869330",
"userSelectedTitleKey": "f8bbad79-853a-4b0e-82ce-634abf3974af",
"rid": "tofu_ontology_object_type_21bf818e_4da3",
"id": "2733d800-6515-448f-9e31-a209b73f4e3d",
"icon": "camera",
"iconColor": "#13C9BA",
"backingDatasource": {
"dataFields": [
{
"id": "f8bbad79-853a-4b0e-82ce-634abf3974af",
"databaseFieldName": "title",
"name": "Ttitle",
"userSelectedType": "string",
"__typename": "Datafield"
},
{
"id": "8b9f2f48-4686-4afc-93c3-bacbc4869330",
"databaseFieldName": "style",
"name": "Style Class",
"userSelectedType": "string",
"__typename": "Datafield"
},
{
"id": "7f6ee0a3-7986-4aa8-b26e-341680e6a842",
"databaseFieldName": "images",
"name": "Images",
"userSelectedType": "string",
"__typename": "Datafield"
}
],
"__typename": "Dataset"
},
"__typename": "DataObjectType"
}
}
}
info

The dataframe can contain very different data depending on your project. A result from one project might differ dramatically from another and your application code should not rely on copying what works for one project to another. Read about the structure of your dataframe and how you can modify it at data lineage.

Mutations

createDataObject

Used to create new data objects to hold your data. A data object is attached to a project and comes with it's own database. This API creates a dataset, datalineage and ontology object type in one go. This is useful to get started with ingesting data right away.

Returns:

dataObject

Inputs:

  • nameSingular (String): A human readable name of the dataobject in singular form
  • namePlural (String): A human readable name of the dataobject in plural form
  • projectID (ID-String): The ID of an existing project
  • dataFields([DataObjectDataFieldsInput]): A list of data fields this object should have. These fields hold the actual data. This is similar to a database schema for your data object.
    • displayName (String): A human readable name for this data field
    • databaseFieldName (String): A slug representing the database field of the displayname (no special characters, only underscores, only lowercase, no hypens)
    • type (String): The datatype of this field, can be one of String,Int,Float,StringArray,IntArray,FloatArray
  • titleKey (String): Name of the data field that represents the title column of your data. This should be the databaseFieldName of your dataField. The title column is used to display entries of this data object throughout the platform. Ideally this is human friendly.
  • primaryKey (String): Name of the data field (databaseFieldName) that represents the primary column of your data. This column is expected to only contain unique entries.
Example

Variables

{
"projectID": "6af9ba91-7589-4425-9a89-ce4349f419a9",
"nameSingular": "User Interview",
"namePlural": "User Interviews",
"dataFields": [
{
"displayName": "User Name",
"databaseFieldName": "name",
"type": "string"
},
{
"displayName": "User ID",
"databaseFieldName": "user_id",
"type": "string"
},
{
"displayName": "Conversation with the user",
"databaseFieldName": "user_conversation",
"type": "string"
},
{
"displayName": "Cohort",
"databaseFieldName": "cohort",
"type": "string"
}
],
"primaryKey": "user_id",
"titleKey": "name",
}

Query

mutation($nameSingular: String, $projectID: ID!, $dataFields: [DataObjectDatafieldsInput!]!, $titleKey: String!, $primaryKey: String!, $namePlural: String) {
createDataObject(nameSingular: $nameSingular, projectID: $projectID, dataFields: $dataFields, titleKey: $titleKey, primaryKey: $primaryKey, namePlural: $namePlural) {
id
}
}

createEntryInOntologyObject

Creates a single row of data in a dataObject (ontologyObject).

Returns:

Boolean (successful/not successful write)

Inputs:

  • rid (RID-String): The ressource ID of the ontology object. You can find this value in the frontend at /workspace/ontology/object/edit/[id of your ontology object]
  • data (JSON-Object): The row data to write to the object. Needs to follow the schema of your data fields.
  • primaryKeyVal (String): The value of the primary key for this row.
Example

Variables

{
"rid": "tofu.ontology.object.type.4892e7d4.cb61",
"data": {"name": "John Doe", "user_id":"83013", "user_conversation": "Hi","cohort": "A"},
"primaryKeyVal": "83013"
}

Query

mutation ($rid: ID!, $data: JSONObject, $primaryKeyVal: String) {
createEntryInOntologyObject(rid: $rid, data: $data, primaryKeyVal: $primaryKeyVal)
}

batchIngestData

Ingests data into data objects. Use this if you want to push multiple objects at once. This endpoint enqueues a data ingest job and returns true when the job has been enequeued. If you rely on the signal when the data ingest is complete, consider subscribing to a liveObjectView (see Listen for status updates ).

Returns:

Boolean (successful/not successful enqueued))

Inputs:

  • rid (RID-String): The ressource ID of the ontology object. You can find this value in the frontend at /workspace/ontology/object/edit/[id of your ontology object]
  • data (JSON-Array): The row data to write to the object. Needs to follow the schema of your data fields.
  • primaryKey (String): The name of the primary key column of the table.
Example

Variables

{
"rid": "tofu.ontology.object.type.4892e7d4.cb61",
"data": [{"name": "John Doe", "user_id":"83013", "user_conversation": "Hello","cohort": "A"}, {"name": "Jane Doe", "user_id":"13013", "user_conversation": "Hello Jane","cohort": "A"}],
"primaryKey": "href"
}

Query

mutation ($rid: ID!, $data: JSONObject, $primaryKey: String) {
batchIngestData(rid: $rid, data: $data, primaryKey: $primaryKey)
}

triggerPipeline

Triggers a pipeline to be executed. A pipeline usually expects inputs, check your pipeline to determine which input to pass to customSettings, this could be a previously uploaded image or text input for instance.

Returns:

Boolean

Inputs:

  • objectTypeId (ID-String): the ontology object type ID
  • ẁorkshopModuleId (ID-String): the module's ID
  • customSettings (Object)
    • name (String): Name of the input variable. Needs to match the input variable name in your pipeline.
    • value (all supported types): the value of your input varible
    • dataType (String): the (supported) type of your value
Example

Variables

{
"triggerId": "8bcbee55-27da-4244-bb92-3ce64f01c2cc",
"workshopModuleId": "119de8de-6ec0-45ab-a5bf-84f602e46c7d",
"customSettings": {"name":"input","value":"s3a://pathToUploadedImage","dataType":"String"},
}

Query

mutation ($triggerId: ID!, $workshopModuleId: ID) {
triggerPipeline(triggerID: $triggerId, workshopModuleID: $workshopModuleId)
}

downloadFiles

Download method to get a public, time limited S3 link to one or multiple files. You may point browsers to this link to view a file.

Returns:

Array(URL)

Inputs:

  • files (Array): an array of files to download
  • fromPath (Boolean): if set to false downloads the file via it's RID, if set to true, downloads the file from a path (e.g. when receiving the path in a dataFrame via getObjectView)
Example

Variables

variables: { files: ['projects/my-project/file'], fromPath: true } }

Query

mutation downloadFiles($files: [FileToDownload!]!, $fromPath: Boolean) {
downloadFiles(files: $files, fromPath: $fromPath)
}

Returns

{
"downloadFiles": ["https://s3.ohmytofu.ai/data/client-results/xxxx-xxx-xxx/20221201215304-4bc05a7a-476045878-1476508276.png?X-Amz-Algorithm=AWS4-HMAC-SHA256%2F20230221%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230221T074905Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=0e5c888bd6de731aaf3cc61c909ed9f1e630f999e29dbac0dacb9a4a71db9684"]
}

uploadFiles

Create a public, timelimited link to load custom files into the system. You may upload files to be used in pipelines.

Returns:

Array(URL)

Inputs:

Example

Variables

variables: {files: fileContent}

Query

mutation($files: [Upload!]!){
uploadTmpFiles(files: $files)
}

Returns

{
"downloadFiles": ["https://s3.ohmytofu.ai/data/client-results/xxxx-xxx-xxx/20221201215304-4bc05a7a-476045878-1476508276.png?X-Amz-Algorithm=AWS4-HMAC-SHA256%2F20230221%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230221T074905Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=0e5c888bd6de731aaf3cc61c909ed9f1e630f999e29dbac0dacb9a4a71db9684"]
}
note

Uploading a file is a two-step process. First you request a public upload URL (the 'presigned url') which is a time limited link to upload a file into our system. In the second step your client (browser) uploads the file to the pre-signed URL.

Example (nodeJS)

  // execute the uploadFile mutation to get the `presignedUrl`
await fetch(presignedUrl, {method: "PUT", body: fileToUpload})
.then((res) => {
// the file path to reference for instance in a downloadFile transaction
// or as the input to a pipeline
let filePath = new URL(res.url)
console.log(filePath)
})
.catch((error) => {
console.error(error)
})
}