// Metadata created by nebel
// ParentAssemblies: assemblies/getting-started/as_installing-the-registry.adoc

[id="writing-registry-client_{context}"]
= Writing {registry} Java client applications

[role="_abstract"]
You can write a Java client application to manage artifacts stored in {registry} by using the {registry} Java client classes.  

.Prerequisites
ifdef::apicurio-registry,rh-service-registry[]
* {registry} is installed and running in your environment.
endif::[]
* You have created a Maven project for your Java client application. For more details, see https://maven.apache.org/index.html[Apache Maven].
ifdef::rh-openshift-sr[]
* You have a service account with the correct access permissions for {registry} instances.
endif::[]

.Procedure
. Add the following dependency to your Maven project:
+
[source,xml,subs="+quotes,attributes"]
----
<dependency>
    <groupId>io.apicurio</groupId>
    <artifactId>apicurio-registry-client</artifactId>
    <version>${apicurio-registry.version}</version>
</dependency>
----

. Create the {registry} client as follows:
+
[source,java,subs="+quotes,attributes"]
----
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/v2"; 
       RegistryClient client = RegistryClientFactory.create(registryUrl); 
    }
}
----
+
* If you specify an example {registry} URL of `\https://my-registry.my-domain.com`, the client will automatically append `/apis/registry/v2`.
* For more options when creating a {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 {registry} REST API in the client. For more details, see the {registry-rest-api}.

[role="_additional-resources"]
.Additional resources
* For an open source example of how to use and customize the {registry} client, see the https://github.com/Apicurio/apicurio-registry-examples[Apicurio Registry REST client demonstration].

* For details on how to use the {registry} Kafka client serializers/deserializers (SerDes) in producer and consumer applications, see {kafka-client-serdes}.
