// Metadata created by nebel
// ParentAssemblies: assemblies/getting-started/as_managing-registry-artifacts.adoc

[id="exporting-importing-using-rest-api"]
= Exporting and importing registry content using Registry REST API commands

[role="_abstract"]
This section shows a simple curl-based example of using the registry v2 core REST API to export and import existing registry data in `.zip` format from one {registry} instance to another. For example, this is useful when migrating or upgrading from one {registry} v2.x instance to another. 

.Prerequisites

* {registry} must be installed and running in your environment. 

.Procedure

. Export the registry data from your existing source {registry} instance:
+
[source,bash]
----
$ curl http://MY-REGISTRY-HOST/apis/registry/v2/admin/export \ 
  --output my-registry-data.zip
----
+
ifdef::apicurio-registry[]
`MY-REGISTRY-HOST` is the host name on which the source {registry} is deployed. For example: `\http://my-source-registry:8080`.
endif::[]

ifdef::rh-service-registry[]
`MY-REGISTRY-HOST` is the host name on which the source {registry} is deployed. For example: `my-cluster-source-registry-myproject.example.com`. 
endif::[]

. Import the registry data into your target {registry} instance:
+
[source,bash]
----
$ curl -X POST "http://MY-REGISTRY-HOST/apis/registry/v2/admin/import" \ 
  -H "Content-Type: application/zip" --data-binary @my-registry-data.zip
----
+
ifdef::apicurio-registry[]
`MY-REGISTRY-HOST` is the host name on which the target {registry} is deployed. For example: `\http://my-target-registry:8080`.
endif::[]

ifdef::rh-service-registry[]
`MY-REGISTRY-HOST` is the host name on which the target {registry} is deployed. For example: `my-cluster-target-registry-myproject.example.com`. 
endif::[]


[role="_additional-resources"]
.Additional resources
* For more details, see the `admin` endpoint in the link:{attachmentsdir}/registry-rest-api.htm[Apicurio Registry REST API documentation]
* For details on export tools for migrating from {registry} version 1.x to 2.x, see link:https://github.com/Apicurio/apicurio-registry/tree/master/utils/exportV1[Apicurio Registry export utility for 1.x versions]
