GET /v1/schema/{id}/versions
Description
Display all inferred parquet schemas, for a specific schema ID, that batch uses to write customer data.
| | | |
| | | Bearer token containing API key |
Path Parameters
| | | |
| | | Bearer token containing API key |
Example response
[
{
"id": "e64ded63-5136-4972-93cf-13de32dc05f5",
"version": 1,
"schema_id": "8d3848ee-c762-49c8-81de-a0472b2a392c",
"definition": {
"Tag": "name=parquet-go-root",
"Fields": [
{
"Tag": "name=name, type=UTF8, repetitiontype=OPTIONAL"
},
{
"Tag": "name=age, type=DOUBLE, repetitiontype=OPTIONAL"
}
]
},
"display": [
{
"name": "name",
"type": "string"
},
{
"name": "age",
"type": "double"
}
]
},
{
"id": "6a3da458-7ecd-4b5e-923a-3a78c07f8202",
"version": 2,
"schema_id": "8d3848ee-c762-49c8-81de-a0472b2a392c",
"definition": {
"Tag": "name=parquet-go-root",
"Fields": [
{
"Tag": "name=name, type=UTF8, repetitiontype=OPTIONAL"
},
{
"Tag": "name=age, type=DOUBLE, repetitiontype=OPTIONAL"
}
]
},
"display": [
{
"name": "name",
"type": "string"
},
{
"name": "age",
"type": "double"
}
]
}
]
GET /v1/schema/{id}
Description
Get a schema by schema_id.
| | | |
| | | Bearer token containing API key |
Path Parameters
Example Response
{
"id":"89114942-a116-4b66-897a-475bc6d900cd",
"name":"Simple",
"root_type":"sample.Message",
"type":"protobuf",
"team_id":"765f94d5-e61d-4043-a4a2-af5913d00f3d",
"shared":false,
"archived":false,
"proto_files":[
{
"id":"c29ca1b2-c34d-4c11-a286-6eca6c027598",
"file_name":"sample-message.proto",
"contents":"syntax = \"proto3\";\n\npackage sample;\n\nmessage Message {\n string data = 1;\n\n // Referenced in sample-message-2.json\n int64 age = 2;\n\n // Referenced in sample-message-3.json\n string foo = 3;\n}\n",
"schema_id":"89114942-a116-4b66-897a-475bc6d900cd",
"inserted_at":"2021-05-11T19:20:15.049974Z",
"updated_at":"2021-05-11T19:20:15.049974Z"
}
],
"inserted_at":"2021-05-11T19:20:15.049974Z",
"updated_at":"2021-05-11T19:20:15.049974Z"
}
GET /v1/schema
Description
Get a list of schemas for a team.
| | | |
| | | Bearer token containing API key |
Example Response
[
{
"id":"cb7a8419-9cec-485d-84e6-36d3ae5d331c",
"name":"Generic JSON",
"root_type":"",
"type":"json",
"team_id":"765f94d5-e61d-4043-a4a2-af5913d00f3d",
"shared":false,
"archived":false,
"inserted_at":"2021-03-14T23:42:12.109951Z",
"updated_at":"2021-03-14T23:42:12.109951Z"
},
{
"id":"5f9b79da-933a-4cc3-b57c-f431e04aeaf1",
"name":"Generic Plain",
"root_type":"",
"type":"plain",
"team_id":"765f94d5-e61d-4043-a4a2-af5913d00f3d",
"shared":false,
"archived":false,
"inserted_at":"2021-03-14T23:42:12.109951Z",
"updated_at":"2021-03-14T23:42:12.109951Z"
},
{
"id":"89114942-a116-4b66-897a-475bc6d900cd",
"name":"Simple Protobuf",
"root_type":"sample.Message",
"type":"protobuf",
"team_id":"765f94d5-e61d-4043-a4a2-af5913d00f3d",
"shared":false,
"archived":false,
"inserted_at":"2021-05-11T19:20:15.049974Z",
"updated_at":"2021-05-11T19:20:15.049974Z"
}
]
POST /v1/schema
Description
Create a new schema.
| | | |
| | | Bearer token containing API key |
Body Parameters
| | | |
| | | Friendly name for the schema |
| | | Root type that all events will use for this collection (must include package name) |
| | | Available options: protobuf |
| | | A base64 encoded ZIP archive containing protobuf schemas |
| | | Which team is this schema associated with |
Example Response
{
"id":"1a52d4af-10b5-4461-8c40-0482efe6adcd",
"name":"SampleSchema",
"root_type":"events.Message",
"type":"protobuf",
"team_id":"765f94d5-e61d-4043-a4a2-af5913d00f3d",
"shared":false,
"archived":false,
"proto_files":[
{
"id":"cdd79947-24c4-49ae-9b5f-5e2ce21932a1",
"file_name":"destinations/redis-streams.proto",
"contents":"syntax = \"proto3\";\n\noption go_package = \"github.com/batchcorp/schemas/build/go/events/destinations\";\n\npackage destinations;\n\nmessage RedisStreams {\n string address = 1;\n int32 database = 2;\n string username = 3;\n string password = 4;\n repeated string streams = 5;\n string write_key = 6;\n}\n",
"schema_id":"1a52d4af-10b5-4461-8c40-0482efe6adcd",
"inserted_at":"2021-06-25T01:29:50.14068Z",
"updated_at":"2021-06-25T01:29:50.14068Z"
},
{
"id":"e2aa7921-45d7-4348-81dd-3babf928bd12",
"file_name":"team.proto",
"contents":"syntax = \"proto3\";\n\noption go_package = \"github.com/batchcorp/schemas/build/go/events\";\n\npackage events;\n\nimport \"account.proto\";\n\nmessage Team {\n string id = 1;\n string name = 2;\n Account account = 3;\n}\n",
"schema_id":"1a52d4af-10b5-4461-8c40-0482efe6adcd",
"inserted_at":"2021-06-25T01:29:50.14068Z",
"updated_at":"2021-06-25T01:29:50.14068Z"
}
],
"inserted_at":"2021-06-25T01:29:50.14068Z",
"updated_at":"2021-06-25T01:29:50.14068Z"
}
PUT /v1/schema
Description
Update an existing schema
If root_type
and schema_archive
are specified, protobuf definitions for the schema will be updated and an UPDATE_PROTOS event will be emitted.
| | | |
| | | Bearer token containing API key |
Body Parameters
| | | |
| | | Which schema this update pertains to |
| | | Update friendly schema name |
| | | Update the root type that Batch should use when decoding messages |
| | | Base64 encoded ZIP archive containing proto files |
| | | Whether to archive the schema or not (not reversible!) |
Example Response
{
"id":"1a52d4af-10b5-4461-8c40-0482efe6adcd",
"name":"SampleSchema",
"root_type":"events.Message",
"type":"protobuf",
"team_id":"765f94d5-e61d-4043-a4a2-af5913d00f3d",
"shared":false,
"archived":false,
"proto_files":[
{
"id":"5488f468-1e52-4f76-992f-86f1d9d55f47",
"file_name":"account.proto",
"contents":"syntax = \"proto3\";\n\noption go_package = \"github.com/batchcorp/schemas/build/go/events\";\n\npackage events;\n\nmessage Account {\n enum OnboardingState {\n PENDING = 0;\n WELCOME = 1;\n DESTINATION = 2;\n INITIAL_EVENT = 3;\n CLOSED = 4;\n }\n\n enum OnboardingStateStatus {\n STATUS_UNSET = 0;\n COMPLETE = 1;\n PROCESSING = 2;\n ERROR = 3;\n SKIPPED = 4;\n }\n\n string id = 1;\n string full_name = 2;\n string email = 3;\n OnboardingState onboarding_state = 4;\n OnboardingStateStatus onboarding_state_status = 5;\n string billing_plan_id = 6;\n bool billing_skip_create_subscription = 7;\n}\n",
"schema_id":"1a52d4af-10b5-4461-8c40-0482efe6adcd",
"inserted_at":"2021-06-25T01:29:50.14068Z",
"updated_at":"2021-06-25T01:29:50.14068Z"
},
{
"id":"d27a84ba-ce81-4c84-9e66-ee9491a48242",
"file_name":"status.proto",
"contents":"syntax = \"proto3\";\n\noption go_package = \"github.com/batchcorp/schemas/build/go/events\";\n\npackage events;\n\noption java_package = \"sh.batch.events\";\noption java_outer_classname = \"ResponseStatus\";\n\nmessage Status {\n // A simple error code that can be easily handled by the client. The\n // actual error code is defined by `google.rpc.Code`.\n int32 code = 1;\n\n // A developer-facing human-readable error message in English. It should\n // both explain the error and offer an actionable resolution to it.\n string message = 2;\n}\n",
"schema_id":"1a52d4af-10b5-4461-8c40-0482efe6adcd",
"inserted_at":"2021-06-25T01:29:50.14068Z",
"updated_at":"2021-06-25T01:29:50.14068Z"
}
],
"inserted_at":"2021-06-25T01:29:50.14068Z",
"updated_at":"2021-06-25T01:42:20.186794Z"
}