Managing Apicurio Registry content using an SDK
You can write a Apicurio Registry client application in Java, Typescript, Python, or Golang to manage artifacts stored in Apicurio Registry.
Apicurio Registry SDK
You can manage artifacts stored in Apicurio Registry by using one of the provided SDKs. You can perform any operation supported by the REST API, including create, read, update, or delete of artifacts. You can even use the Apicurio Registry SDKs to perform administrator functions, such as managing global rules or importing and exporting Apicurio Registry data.
You can use any of the following SDKs provided as part of Apicurio Registry:
-
Java
-
Typescript
-
Python
-
Golang
Java
You can access the Apicurio Registry Java SDK by adding the correct dependency to your Apache Maven project. For more details, see Writing Apicurio Registry SDK applications.
The Apicurio Registry client is implemented by using the HTTP client provided by the JDK. You can customize the client as needed, for example, by adding custom headers or enabling configuration options for Transport Layer Security (TLS) authentication. For more details, see Apicurio Registry Java SDK configuration.
Typescript
You can access the Apicurio Registry Typescript SDK by adding the correct dependency to your application’s package.json
file (assumes a node.js application):
Python
You can access the Apicurio Registry Python SDK by adding the correct dependency to your python project (assumes you are using pypi):
Golang
You can access the Apicurio Registry Golang SDK by adding the correct dependency to your project:
Writing Apicurio Registry SDK applications
You can write a client application to manage artifacts stored in Apicurio Registry by using one of the Apicurio Registry SDKs.
-
Apicurio Registry is installed and running in your environment.
-
You have created a Maven project for your Java client application. For more details, see Apache Maven.
-
Add the following dependency to your Maven project:
<dependency> <groupId>io.apicurio</groupId> <artifactId>apicurio-registry-java-sdk</artifactId> <version>${apicurio-registry.version}</version> </dependency> -
Create the Apicurio Registry client as follows:
import io.vertx.core.Vertx;public class ClientExample { public static void main(String[] args) throws Exception { // Create a registry client String registryUrl = "https://my-registry.my-domain.com/apis/registry/v3"; (1) Vertx vertx = Vertx.vertx(); (2) VertXRequestAdapter vertXRequestAdapter = new VertXRequestAdapter(vertx); vertXRequestAdapter.setBaseUrl(REGISTRY_URL); RegistryClient client = new RegistryClient(vertXRequestAdapter); (3) // Use client here vertx.close(); (4) } }1 If you specify an example Apicurio Registry URL of https://my-registry.my-domain.com, the client automatically appends/apis/registry/v3.2 Create a new Vertx object (needed by the VertxRequestAdapter) 3 For more options when creating a Apicurio Registry client, see Apicurio Registry Java SDK configuration. 4 When you are done with the client, close the Vertx object to free its resources.
When the client is created, you can use all of the operations available in the Apicurio Registry REST API in the client. For more details, see the Apicurio Registry REST API documentation.
Apicurio Registry Java SDK configuration
The Apicurio Registry Java client supports several configuration options, including client factory settings, custom headers, TLS authentication, and OpenTelemetry distributed tracing.
| Option | Description | Arguments |
|---|---|---|
Plain client |
Connects to a running Apicurio Registry with no additional configuration. |
|
Client with custom configuration |
Apicurio Registry client that uses the configuration that you provide. |
|
Client with custom configuration and authentication |
Accepts a map containing custom configuration and an authentication server. You can use this option to add custom headers and authenticate requests. |
|
Custom header configuration
To configure custom headers, add the apicurio.registry.request.headers prefix to the configs map key. For example, a configs map key of apicurio.registry.request.headers.Authorization with a value of Basic: YWxhZGRpbjpvcGVuc2VzYW1 sets the Authorization header with the same value.
TLS configuration properties
The following properties configure Transport Layer Security (TLS) authentication for the Apicurio Registry Java client:
-
apicurio.registry.request.ssl.truststore.location -
apicurio.registry.request.ssl.truststore.password -
apicurio.registry.request.ssl.truststore.type -
apicurio.registry.request.ssl.keystore.location -
apicurio.registry.request.ssl.keystore.password -
apicurio.registry.request.ssl.keystore.type -
apicurio.registry.request.ssl.key.password
OpenTelemetry distributed tracing
The Apicurio Registry Java SDK supports optional OpenTelemetry trace context propagation. When enabled, W3C trace context headers (traceparent and tracestate) are injected into every HTTP request made to Apicurio Registry, providing end-to-end distributed tracing across your services and the registry.
- Enabling tracing
-
Call
enableOpenTelemetry()when building the client options:RegistryClientOptions options = RegistryClientOptions.create() .registryUrl("http://localhost:8080") .enableOpenTelemetry(); RegistryClient client = RegistryClientFactory.create(options); - Required dependency
-
The
opentelemetry-apilibrary must be on the classpath. Add it to your project if it is not already provided transitively:<dependency> <groupId>io.opentelemetry</groupId> <artifactId>opentelemetry-api</artifactId> <version>${opentelemetry.version}</version> </dependency> - Runtime behavior
-
When an OpenTelemetry SDK is initialized in your application (for example, through the OpenTelemetry Java agent or the Quarkus OpenTelemetry extension), the Apicurio Registry SDK participates in the active trace. If no OpenTelemetry SDK is configured, the behavior is a no-op and no trace headers are added.
| This feature also applies to the Apicurio Registry Kafka client serializers/deserializers (SerDes), which use the SDK internally to communicate with Apicurio Registry. See Validating schemas using Kafka client serializers/deserializers in Java clients for SerDes-specific configuration. |
