[id='rest_v2_create_protobuf']
= Creating Protobuf Schemas
Create Protobuf schemas across {brandname} clusters with `POST` requests that
include the content of a protobuf file in the payload.

[source,options="nowrap",subs=attributes+]
----
POST /rest/v2/schemas/{schemaName}
----

If the schema already exists, {brandname} returns HTTP `409 (Conflict)`.
If the schema is not valid, either because of syntax errors, or because some of its dependencies are missing,
{brandname} stores the schema and returns the error in the response body.

{brandname} responds with the schema name and any errors.

[source,json,options="nowrap",subs=attributes+]
----
include::json/rest_protobuf_create_update_schema_response.json[]
----

* `name` is the name of the Protobuf schema.
* `error` is `null` for valid Protobuf schemas. If {brandname} cannot successfully validate the schema, it returns errors.

If the operation successfully completes, the service returns `201 (Created)`.

[id='rest_v2_get_protobuf']
= Reading Protobuf Schemas
Retrieve Protobuf schema from {brandname} with `GET` requests.

[source,options="nowrap",subs=attributes+]
----
GET /rest/v2/schemas/{schemaName}
----

[id='rest_v2_update_protobuf']
= Updating Protobuf Schemas
Modify Protobuf schemas with `PUT` requests that include the content of a protobuf file in the payload.

[IMPORTANT]
====
When you make changes to the existing Protobuf schema definition, you must either update or rebuild the index schema.
If the changes involve modifying the existing fields, then you must rebuild the index.
When you add new fields without touching existing schema, you can update the index schema instead of rebuilding it.
====

[source,options="nowrap",subs=attributes+]
----
PUT /rest/v2/schemas/{schemaName}
----

If the schema is not valid, either because of syntax errors, or because some of its dependencies are missing,
{brandname} updates the schema and returns the error in the response body.

[source,json,options="nowrap",subs=attributes+]
----
include::json/rest_protobuf_create_update_schema_response.json[]
----

* `name` is the name of the Protobuf schema.
* `error` is `null` for valid Protobuf schemas. If {brandname} cannot successfully validate the schema, it returns errors.

[id='rest_v2_delete_protobuf']
= Deleting Protobuf Schemas
Remove Protobuf schemas from {brandname} clusters with `DELETE` requests.

[source,options="nowrap",subs=attributes+]
----
DELETE /rest/v2/schemas/{schemaName}
----
If the operation successfully completes, the service returns `204 (No Content)`.

[id='rest_v2_list_protobuf']
= Listing Protobuf Schemas
List all available Protobuf schemas with `GET` requests.

[source,options="nowrap",subs=attributes+]
----
GET /rest/v2/schemas/
----

{brandname} responds with a list of all schemas available on the cluster.

[source,json,options="nowrap",subs=attributes+]
----
include::json/rest_protobuf_schemas_response.json[]
----

* `name` is the name of the Protobuf schema.
* `error` is `null` for valid Protobuf schemas. If {brandname} cannot successfully validate the schema, it returns errors.

[id='rest_v2_list_protobuf_types']
= Listing Protobuf Types
List all available Protobuf types with `GET` requests.

[source,options="nowrap",subs=attributes+]
----
GET /rest/v2/schemas?action=types
----

{brandname} responds with a list of all types available on the cluster.

[source,json,options="nowrap",subs=attributes+]
----
include::json/rest_protobuf_types_response.json[]
----
