Export Databases

Export databases as downloadable database artifacts

The Data Bridge Databases API enables Intelligent Risk Platform tenants to export databases as a database artifact. A database artifact is a copy of a database that has been saved to a particular format for backup, storage, or data transfer.

The Data Bridge API supports processes for importing and exporting database artifacts in the BAK, MDF, or DACPAC formats.

🍐

Role-based Permissions

To perform this operation, a principal must belong to a group that has been assigned the appropriate role-based permissions. The table identifies the roles with permission to perform this operation.

ConsumerContributorAdmin
YESYESNO

To learn more about role-based permissions in Data Bridge, see Groups and Roles.

Step 1: Get managed server instance

The Get server instances operation ( GET /databridge/v1/sql-instances) returns high-level information about a tenant's managed server instances.

A managed server instance is an instance of a Microsoft SQL Server that is hosted and managed by Data Bridge.

curl --request GET \
     --url 'https://{host}/databridge/v1/sql-instances?adminMode=true' \
     --header 'Authorization: XXXXXXXXXX' \
     --header 'accept: text/plain'

The optional adminMode query parameter enables the principal making the request to view managed server instances that are owned by other principals. The principal must belong to a group that has been assigned the Admin role.

A successful response returns a 200 OK status code and an array of server instances. For each server instance, the operation returns the name, unique ID, and URI.

[
  {
    "name": "myServerInstance",
    "uid": "4600d1f1-843c-4394-XXXX-458c5fa0aa17",
    "endpoint": "a9baf781fb8ce40ebd3ff4dab4d77d79.XXX.XXXXX",
    "internalEndpoint": "string",
    "status": "string",
    "totalDiskSpaceInMb": 0,
    "availableDiskSpaceInMb": 0,
    "usedDiskSpaceInMb": 0,
    "databaseLimit": 0,
    "pinnedDatabaseLimit": 0
  }
]

The client must specify the name of a managed server instance when it imports a database.

You can now use the name of the server instance (myServerInstance) to identify the database you want to export.

Step 2: Get hosted database

The Get databases operation GET /databridge/v1/sql-instances/{instanceName}/databases returns a list of databases on the specified server instance.

The required instanceName path parameter specifies the name of the managed server instance myServerInstance that hosts the database we want to export.

curl --request GET \
     --url 'https://{host}/databridge/v1/sql-instances/myServerInstance/Databases?adminMode=true' \
     --header 'Authorization: XXXXXXXXXX' \
     --header 'accept: text/plain'

The optional adminMode query parameter enables the principal making the request to view databases that are owned by other principals. The principal must belong to a group that has been assigned the Admin role.

The operation returns 200 OK status code and a list of the databases on the specified server instance:

[
  {
    "name": "Aldaris",
    "sizeInMb": "12"
  },
  {
    "name": "myDatabase",
    "sizeInMb": "14"
  }
]

Now that you have the names of server instance (myServerInstance) and database (myDatabase) , you can export the database to your preferred format for downloading.

Step 3: Export database as database artifact

The Export database operation (POST /databridge/v1/sql-instances/{instanceName}/Databases/{databaseName}/export) enables you to export a database from a managed server instance as a database artifact. The operation supports database artifacts in the BAK, DACPAC, or MDF format.

The operation takes two required query parameters: instanceName and databaseName. The instanceName specifies the name of a manageed server instance. The databaseName specifies the name of a hosted database on the specified server instance.

The required exportTo query parameter specifies the format of the database artifact: 0 for MDF, 1 for BAK, and 2 for DACPAC. If no value is specified, the file is automatically exported as a BAK file.

curl --request POST \
     --url 'https://{host}/databridge/v1/sql-instances/myServerInstance/Databases/myDatabaseInstance/export?exportTo=0' \
     --header 'Authorization: XXXXXXXXXX' \
     --header 'accept: text/plain'

If the request is successful, the API returns a 202 Accepted response status code and the jobId. Use the jobId to track the progress of the export job.

{
  "jobId": 5ee3051a-5508-4800-8af4-88324e4180f6,
}

Step 4: Get database artifact URI

The Get job status operation (GET /databridge/v1/Jobs/{jobId}) retrieves information about a specified workflow job and, once complete, displays the URI for downloading exported artifacts.

The jobId path parameter specifies the ID number of a workflow job returned in Step 3.

curl --location -g --request GET '{host}/databridge/v1/Jobs/5ee3051a-5508-4800-8af4-88324e4180f6' \
--header 'Authorization: Bearer XXXXXXXXXXXX'

When the job is complete, the status is set to FINISHED and the response returns the URI of the exported database artifact.

{
  "jobId": 5ee3051a-5508-4800-8af4-88324e4180f6,
  "uri": <URI to the exported database artifact>j
}