For AI agents: The documentation index is at https://docs.digitalocean.com/llms.txt. Markdown versions of pages use the same URL with index.html.md in place of the HTML page (for example, append index.html.md to the directory path instead of opening the HTML document).
Usage
client.v2.databases.byDatabase_cluster_uuid(database_cluster_uuid).schemaRegistry.post(body: Database_kafka_schema_create, requestConfiguration?: RequestConfiguration<object>): Promise<undefined | Kafka_schema_verbose>
Description
To create a Kafka schema for a database cluster, send a POST request to
/v2/databases/{database_cluster_uuid}/schema-registry.
Parameters
Path Parameters
database_cluster_uuid string required
Example: 9cc10173-e9ea-4176-9dbc-a4cee4c4ff30
A unique identifier for a database cluster.
Request Body
subjectName string required
Example: customer-schema
The name of the schema subject.
schemaType string required
The type of the schema.
One of: AVRO, JSON, PROTOBUF
schema string required
Example: { "type": "record", "name": "Customer", "fields": [ {"name": "id", "type": "int"}, {"name": "name", "type": "string"} ] }
The schema definition in the specified format.
Request Sample
Show Request Sample
import { FetchRequestAdapter } from "@microsoft/kiota-http-fetchlibrary";
import {
createDigitalOceanClient,
DigitalOceanApiKeyAuthenticationProvider,
} from "@digitalocean/dots";
const authProvider = new DigitalOceanApiKeyAuthenticationProvider(process.env.DIGITALOCEAN_TOKEN!);
const adapter = new FetchRequestAdapter(authProvider);
const client = createDigitalOceanClient(adapter);
const response = await client.v2.databases
.byDatabase_cluster_uuid("9cc10173-e9ea-4176-9dbc-a4cee4c4ff30").schemaRegistry.post({
subjectName: "customer-schema",
schemaType: "AVRO",
schema: "{\n \"type\": \"record\",\n \"name\": \"Customer\",\n \"fields\": [\n {\"name\": \"id\", \"type\": \"string\"},\n {\"name\": \"name\", \"type\": \"string\"},\n {\"name\": \"email\", \"type\": \"string\"},\n {\"name\": \"created_at\", \"type\": \"long\"}\n ]\n}\n",
});
Response Example
Show Response Example
{
"schema_id": 12345,
"subject_name": "customer-schema",
"schema_type": "AVRO",
"schema": "{\n \"type\": \"record\",\n \"name\": \"Customer\",\n \"fields\": [ \n {\"name\": \"id\", \"type\": \"int\"},\n {\"name\": \"name\", \"type\": \"string\"}\n ]\n} "
}
See /v2/databases/{database_cluster_uuid}/schema-registry in the API reference for additional detail on responses, headers, parameters, and more.