Exporting and Importing Repository Configuration via REST
This page explains how to execute REST calls allowing you to export and import repositories.
On this page
General
ADx provides REST services allowing you to export and import repository configuration. All export services allow you to export all repositories, but you can also retrieve configuration by any of the following categories:
- Repository ID (
/export/configuration/
endpoint) - Repository name (
/export/configuration/by-names
endpoint) - Repository technical name (
/export/configuration/by-technical-names
)
Import is always done through the /import/configuration
endpoint. Check Endpoints for detailed information on what each endpoint can do.
You can get all of the export parameters in the Administration Area in the UI. Name and technical name are visible in the preview:
ID is visible in the detailed view of the repository (select Details to open):
cURL Example - Repository Migration Between Hosts
The example below shows a typical workflow consisting of 4 cURL requests, where you export a configuration from one host and import it into another one.
Adapt the following parts of the below requests:
https://[HOST]:[PORT]
- adjust the protocol (http
orhttps
) and host name.[USER_NAME]
- replace with your user name[PASSWORD]
- replace with your passwordrepositoryNames
- replace with real repository names, as in-F repositoryNames=["Real name 1","Real name 2"]
@/path/to/myrepo-export.zip
- replace with the actual path (for example@/mnt/c/Downloads/myrepo-export.zip
)
# open session to ADx host
ADX_DEV_SESSION_ID=$(curl --silent --location --insecure --request POST 'https://[HOST]:[PORT]/tribefire-services/api/v1/authenticate?user=[USER_NAME]&password=[PASSWORD]' --header 'Content-Type: application/json' | cut -d '"' -f 2)
# export repository from ADx-dev to myrepo-export.zip
curl --insecure --request GET "https:///[HOST]:[PORT]/tribefire-services/api/v1/access.adx.admin/v1/export/configuration/by-names?sessionId=${ADX_DEV_SESSION_ID}" --header "accept: application/json" -F repositoryNames="[Real name 1,Real name 2]" --output /path/to/myrepo-export.zip
# open session to ADx host (ignore if you're calling the same ADx instance)
ADX_TEST_SESSION_ID=$(curl --silent --location --insecure --request POST 'https://[host]:[port]/tribefire-services/api/v1/authenticate?user=admin&password=password' --header 'Content-Type: application/json' | cut -d '"' -f 2)
# import repository from myrepo-export.zip to ADx
curl --insecure --request POST "https://[host]:[port]/tribefire-services/api/v1/access.adx.admin/v1/import/configuration?sessionId=${ADX_TEST_SESSION_ID}" --header "accept: application/json" --header "Content-Type: multipart/form-data" --form "autoSync=true" --form "importRepositoryOption=full" --form "importUsersOption=none" --form "useRuntimeValues=false" --form "resource=@/path/to/myrepo-export.zip;type=application/zip"
The video below shows how to send adopted cURL requests to ADx:
Endpoints
You can use three different endpoints to export repositories (by ID, by name or by technical name). Importing is always done via the import/configuration
endpoint. Export query parameters are optional - if you don't enter them, all repositories will be exported. Check Parameters below for information on request parameters and their values.
You need to authenticate before using any of the below endpoints - session ID must be passed as a query parameter.
Request type | Service description | Endpoint | Request query parameters | Form data | Returns |
---|---|---|---|---|---|
GET | Export repository configuration by IDs | https://host:port/tribefire-services/api/v1/access.adx.admin/v1/export/configuration/ | sessionId, repositoryIds (array) | none | .zip file with repository configuration |
GET | Export repository configuration by names | https://host:port/tribefire-services/api/v1/access.adx.admin/v1/export/configuration/by-names | sessionId, repositoryNames (array) | none | .zip file with repository configuration |
GET | Export repository configuration by technical name | https://host:port/tribefire-services/api/v1/access.adx.admin/v1/export/configuration/by-technical-names | repositoryTechnicalNames (array) | none | .zip file with repository configuration |
POST | Import repository configuration | https://host:port/tribefire-services/api/v1/access.adx.admin/v1/import/configuration | none | autoSync, importRepositoryOption, importUsersOption, resource, useRuntimeValues |
Parameters
Parameter | Data type | Description |
---|---|---|
sessionId | string | Session ID returned when you authenticate |
repositoryIds | array | Array of one or more repository IDs, for example ["ab-cd-1234", "ef-gh-5678"] |
repositoryNames | array | Array of one or more repository names, for example ["Repository name 1", "Repository name 2"] |
repositoryTechnicalNames | array | Array of one or more repository technical names, for example ["Technical name 1", "Technical name 2"] |
autoSync | boolean | Indicates whether affected repositories should be automatically synchronized after import. |
importRepositoryOption | string | Specifies option for repository import. delta - import only missing configuration, full - do a full import, none - do not import repository configuration (in case you only want to import users) |
importUsers | boolean | Indicates whether users/roles/groups should be imported. |
resource | string | File system path to the previously exported .zip archive with repository configuration to be imported. |
useRuntimeValues | boolean | Indicates whether environment specific runtime values should be used instead of the values from the export package. |
Try It Out in OpenAPI/Swagger
All of the above endpoints are documented and exposed in our OpenAPI and Swagger pages, where you can try them out.
-
Log in to ADx. Open Administrator API from the landing page:
A list of repository endpoints is exposed. Switch to Swagger 2.0 in case of any issues in the default page:
-
Find the Export/Import section (on top of the page):
-
Expand and try out the endpoints yourself, following the guidelines provided in Swagger.
Exporting via ADx UI
You can execute the services described above via ADx Administration UI. See Exporting and Importing Repository Configuration via ADx UI for more information.