📖

Mainframe Docs

ℹ️
Mainframe is still in early alpha. Help inform our development by joining our discord or booking a call!

API

📚 Table Rows

Path: /api/table/:table_id/rows

Get the rows of a table. You can find the table_id on the “HTTP” tab.

Example:

const res = await fetch(`https://api.mainframe.so/api/table/${tableId}/rows`, {
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
});

const body = await res.json() as { id: string, data: TYPE }[]

console.log(body)
// [
//   {
//     id: string,
//     data: { … } // row data
//   },
//   { … },
//   …
// ]

📦 Object

Path: /api/object/:dataset_id/:object_type

Get an object. You can find the dataset_id and object_type on the URL of your object. For example, my “Current User” GitHub object is at dataset/8473dd85861a04cc36b89100cb398986/object/currentUser, which means:

  • dataset_id = "8473dd85861a04cc36b89100cb398986"
  • object_type = "currentUser"

Example:

const res = await fetch(
	`https://api.mainframe.so/api/object/${datasetId}/${objectType}`,
	{
	  headers: {
	    Authorization: `Bearer ${apiKey}`,
	  },
	}
);

const body = await res.json() as { id: string; data: TYPE }

console.log(body)
// { id: string, data: {…}  }

🔒 Credentials

Path: /api/credentials/:dataset_id

Obtain the credentials for a dataset. You can find the dataset_id on the URL of your dataset.

ℹ️
This API doesn’t support datasets connected using OAuth yet.

Example:

const res = await fetch(
	`https://api.mainframe.so/api/credentials/${datasetId}`,
	{
	  headers: {
	    Authorization: `Bearer ${apiKey}`,
	  },
	}
);

const body = await res.json() as { token: string }

console.log(body)
// { token: "6508846829164d32bd9b12468f569143" }