Managing Apicurio Registry content using a SDK
You can write a Apicurio Registry client application (in Java, Typescript, Python, or Golang) and use it 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 desired 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, which you can customize as needed. For example, you can add custom headers or enable 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):
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.
Using the Apicurio Registry Java SDK
-
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:
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) VertXRequestAdapter vertXRequestAdapter = new VertXRequestAdapter(VertXAuthFactory.defaultVertx); vertXRequestAdapter.setBaseUrl(REGISTRY_URL); RegistryClient client = new RegistryClient(vertXRequestAdapter); (2) } }
1 If you specify an example Apicurio Registry URL of https://my-registry.my-domain.com
, the client will automatically append/apis/registry/v3
.2 For more options when creating a Apicurio Registry client, see the Java client configuration in the next section.
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.
-
For an open source example of how to use and customize the Apicurio Registry client, see the Apicurio Registry REST client demonstration.
-
For details on how to use the Apicurio Registry Kafka client serializers/deserializers (SerDes) in producer and consumer applications, see Validating schemas using Kafka client serializers/deserializers in Java clients.
Apicurio Registry Java SDK configuration
The Apicurio Registry Java client includes the following configuration options, based on the client factory:
Option | Description | Arguments |
---|---|---|
Plain client |
Basic REST client used to interact with a running Apicurio Registry. |
|
Client with custom configuration |
Apicurio Registry client using the configuration provided by the user. |
|
Client with custom configuration and authentication |
Apicurio Registry client that accepts a map containing custom configuration. For example, this is useful to add custom headers to the calls. You must also provide an authentication server to authenticate the requests. |
|
Custom header configuration
To configure custom headers, you must 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 options
You can configure Transport Layer Security (TLS) authentication for the Apicurio Registry Java client using the following properties:
-
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
-
For details on how to configure authentication for Apicurio Registry Kafka client serializers/deserializers (SerDes), see Validating schemas using Kafka client serializers/deserializers in Java clients.