PUT
/v1/databases/{databaseId}/definitionbetaapiKeyworkspace
When to use
Save managed table schemas as one draft revision.
For agents
Requires database admin permission. Publish through client.revisions after reading its current version token. Author business actions separately through client.actions and bind them to the published schema revision.
Example
import { PermuteClient } from '@permute/sdk';
const orgClient = new PermuteClient({
apiKey: process.env.PERMUTE_API_KEY!,
});
const client = orgClient.withWorkspace(process.env.PERMUTE_WORKSPACE_ID!);
const result = await client.databases.saveDefinition('dbas_crm123', {
"expectedDraft": null,
"definition": {
"tables": [
{
"name": "customers",
"columns": [
{
"name": "id",
"type": "text",
"nullable": false
},
{
"name": "name",
"type": "text",
"nullable": false
}
],
"primaryKey": [
"id"
]
}
]
}
});Request body
{
"expectedDraft": null,
"definition": {
"tables": [
{
"name": "customers",
"columns": [
{
"name": "id",
"type": "text",
"nullable": false
},
{
"name": "name",
"type": "text",
"nullable": false
}
],
"primaryKey": [
"id"
]
}
]
}
}Response
{
"data": {
"revisionId": "rvsn_database1"
}
}