Navigation

Create One Legacy Backup Restore Job

Important With Circle IconCreated with Sketch.Important
Legacy Backup Deprecated

MongoDB deprecated the Legacy Backup feature. Clusters that use Legacy Backup can continue to use it. MongoDB recommends using Cloud Backups. Effective 23 March 2020, all new clusters can only use Cloud Backups.

Info With Circle IconCreated with Sketch.Note

Groups and projects are synonymous terms. Your {GROUP-ID} is the same as your project ID. For existing groups, your group/project ID remains the same. The resource and corresponding endpoints use the term groups.

Creates one restore job for the specified cluster.

This endpoint doesn't support the following:

  • Creating checkpoint restore jobs for sharded clusters
  • Creating restore jobs for queryable backup snapshots
Important With Circle IconCreated with Sketch.Important

If you create an automated restore job by specifying delivery.methodName of AUTOMATED_RESTORE in your request body, Atlas removes all existing data on the target cluster prior to the restore.

The Atlas API authenticates using HTTP Digest Authentication. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request.

To learn how to configure API access for an Atlas project, see Configure Atlas API Access.

All requests to this endpoint must originate from an IP address in the organization's API access list.

Bulb IconTip
See Also:

https://cloud.mongodb.com/api/atlas/v1.0

POST /groups/{GROUP-ID}/clusters/{CLUSTER-NAME}/restoreJobs
Path ParameterTypeNecessityDescription
GROUP-IDstringRequiredUnique identifier of the project that owns the snapshots.
CLUSTER-NAMEstringRequiredName of the cluster that contains the snapshots that you want to retrieve.

This endpoint may use any of the HTTP request query parameters available to all Atlas API resources. These are all optional.

NameTypeNecessityDescriptionDefault
pageNumintegerOptionalPage number, starting with one, that Atlas returns of the total number of objects.1
itemsPerPageintegerOptionalNumber of items that Atlas returns per page, up to a maximum of 500.100
includeCountbooleanOptionalFlag that indicates whether Atlas returns the totalCount parameter in the response body.true
prettybooleanOptionalFlag that indicates whether Atlas returns the JSON response in the prettyprint format.false
envelopebooleanOptional

Flag that indicates whether Atlas wraps the response in an envelope.

Some API clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query.

Endpoints that return a list of results use the results object as an envelope. Atlas adds the status parameter to the response body.

false
Body ParameterTypeNecessityDescription
checkpointIdstring
Conditional:
"delivery.methodName" : "AUTOMATED_RESTORE"
for Sharded Clusters Only.

Unique identifier for the sharded cluster checkpoint that represents the point in time to which your data will be restored.

Info With Circle IconCreated with Sketch.Note

If you set checkpointId, you cannot set oplogInc, oplogTs, snapshotId, or pointInTimeUTCMillis.

If you provide this setting, this endpoint restores all data up to this checkpoint to the database you specify in the delivery object.

deliveryobjectRequiredMethod and details of how the restored snapshot data will be delivered.
delivery
.expirationHours
number
Conditional:
"delivery.methodName" : "HTTP"
Number of hours the download URL is valid once the restore job is complete.
delivery
.maxDownloads
number
Conditional:
"delivery.methodName" : "HTTP"
Number of times the download URL can be used. This must be 1 or greater.
delivery
.methodName
stringRequired

Means by which the data is delivered. Accepted values are:

  • AUTOMATED_RESTORE
  • HTTP
Info With Circle IconCreated with Sketch.Note

If you set "delivery.methodName" : "AUTOMATED_RESTORE", you must also set:

  • delivery.targetGroupId and
  • delivery.targetClusterName or delivery.targetClusterId

In addition, the response shows the delivery.methodName as HTTP. An automated restore uses the HTTP method to deliver the restore job to the target host.

delivery
.targetClusterId
string
Conditional:
"delivery.methodName" : "AUTOMATED_RESTORE"

Unique identifier of the target cluster. Use the clusterId returned in the response body of the Get All Snapshots and Get a Snapshot endpoints. For use only with automated restore jobs.

Info With Circle IconCreated with Sketch.Note

If backup is not enabled on the target cluster, the Get All Snapshots endpoint returns an empty results array without clusterId elements, and the Get a Snapshot endpoint also does not return a clusterId element. Use the delivery.targetClusterName parameter instead or enable backup on the target cluster.

delivery
.targetClusterName
string
Conditional:
"delivery.methodName" : "AUTOMATED_RESTORE"

Name of the target cluster. Use the clusterName returned in the response body of the Get All Snapshots and Get a Snapshot endpoints. For use only with automated restore jobs.

Info With Circle IconCreated with Sketch.Note

If backup is not enabled on the target cluster, the Get All Snapshots endpoint returns an empty results array without clusterName elements, and the Get a Snapshot endpoint also does not return a clusterName element. Use the delivery.targetClusterName parameter instead or enable backup on the target cluster.

delivery
.targetGroupId
string
Conditional:
"delivery.methodName" : "AUTOMATED_RESTORE"
Unique identifier of the project that contains the destination cluster for the restore job.
oplogTsstring
Conditional:
"delivery.methodName" : "AUTOMATED_RESTORE"

Oplog timestamp given as a timestamp in the number of seconds that have elapsed since the UNIX epoch. When paired with oplogInc, they represent the point in time to which your data will be restored.

Run a query against local.oplog.rs on your replica set to find the desired timestamp.

Info With Circle IconCreated with Sketch.Note

If you set oplogTs, you:

  • Must set oplogInc.
  • Cannot set checkpointId, snapshotId, or pointInTimeUTCMillis.

If you provide this setting, this endpoint restores all data up to and including this Oplog timestamp to the database you specified in the delivery object.

oplogIncstring
Conditional:
"delivery.methodName" : "AUTOMATED_RESTORE"

32-bit incrementing ordinal that represents operations within a given second. When paired with oplogTs, they represent the point in time to which your data will be restored.

Info With Circle IconCreated with Sketch.Note

If you set oplogInc, you:

  • Must set oplogTs.
  • Cannot set checkpointId, snapshotId, or pointInTimeUTCMillis.

If you provide this setting, this endpoint restores all data up to and including this Oplog timestamp to the database you specified in the delivery object.

pointInTimeUTCMillislong
Conditional:
"delivery.methodName" : "AUTOMATED_RESTORE"

timestamp in the number of milliseconds that have elapsed since the UNIX epoch that represents the point in time to which your data will be restored. This timestamp must be within last 24 hours of the current time.

If you provide this setting, this endpoint restores all data up to this point in time to the database you specified in the delivery object.

Info With Circle IconCreated with Sketch.Note

If you set pointInTimeUTCMillis, you cannot set oplogInc, oplogTs, snapshotId, or checkpointId.

snapshotIdstringRequired

Unique identifier of the snapshot to restore.

Info With Circle IconCreated with Sketch.Note

If you set snapshotId, you cannot set oplogInc, oplogTs, pointInTimeUTCMillis, or checkpointId.

NameTypeDescription
batchIdstring

Unique identifier of the batch to which this restore job belongs.

Only present for a restore of a sharded cluster.

clusterIdstring

Unique identifier of the cluster the restore job represents.

Only present for a restore of a cluster.

createdstringTimestamp in ISO 8601 date and time format in UTC when the restore job was requested.
deliveryobjectMethod and details of how the restored snapshot data shall be delivered.
delivery.expiresstring

Timestamp in ISO 8601 date and time format in UTC after which the URL is no longer available.

Only present if "delivery.methodName" : "HTTP".

delivery.expirationHoursnumber

Number of hours the download URL is valid once the restore job is complete.

Only present if "delivery.methodName" : "HTTP".

delivery.maxDownloadsnumber

Number of times the download URL can be used. This must be 1 or greater.

Only present if "delivery.methodName" : "HTTP".

delivery.methodNamestring

Means by which the data is delivered. Accepted values include:

  • HTTP
  • QUERY
delivery.statusNamestring

Current status of the downloadable file. Accepted values include:

  • NOT_STARTED
  • IN_PROGRESS
  • READY
  • FAILED
  • INTERRUPTED
  • EXPIRED
  • MAX_DOWNLOADS_EXCEEDED
delivery.urlstring

URL from which the restored snapshot data can be downloaded.

Only present if "delivery.methodName" : "HTTP".

encryptionEnabledbooleanIndicates whether the restored snapshot data is encrypted.
groupIdstringUnique identifier of the project that owns the restore job.
hashesobject array

If the corresponding delivery.url has been downloaded, each document in this array is a mapping of a restore file to a hashed checksum. This array is present only after the file is downloaded.

Info With Circle IconCreated with Sketch.Note

For an HTTP restore, this array only contains a single object that represents the hash of the .tar.gz file.

hashes.typeNamestringHashing algorithm used to compute the hash value. If present, this value is SHA1.
hashes.fileNamestringName of the file that has been hashed.
hashes.hashstringHash of the file.
idstringUnique identifier of the restore job.
linksdocument arrayOne or more links to sub-resources and/or related resources. The relations between URLs are explained in the Web Linking Specification
masterKeyUUIDstring

KMIP master key ID used to encrypt the snapshot data.

Only if encryptionEnabled is true for the snapshot.

snapshotIdstringUnique identifier of the snapshot to restore.
statusNamestring

Current status of the job. Accepted values include:

  • FINISHED
  • IN_PROGRESS
  • BROKEN
  • KILLED
timestampobjectTimestamp of the Oplog entry when the snapshot was created.
timestamp.datestringTimestamp in ISO 8601 date and time format in UTC of the latest oplog entry in the restored snapshot.
timestamp.incrementstringOrder of all operations completed at the latest oplog entry in the restored snapshot.

Create a restore job that transfers a compressed snapshot using HTTP .

curl --user "{USERNAME}:{APIKEY}" --digest \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--include \
--request POST "https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}/clusters/{CLUSTER-NAME}/restoreJobs?pretty=true" \
--data '
{
"delivery" : {
"expirationHours" : "1",
"maxDownloads" : "1",
"methodName" : "HTTP"
},
"snapshotId" : "{SNAPSHOT-ID}"
}'
{
"batchId": "{BATCH-ID}",
"clusterId": "{CLUSTER-ID}",
"clusterName": "{CLUSTER-NAME}",
"created": "2018-09-20T15:00:00Z",
"delivery": {
"expirationHours": 1,
"maxDownloads": 1,
"methodName": "HTTP",
"statusName": "READY"
},
"encryptionEnabled": false,
"groupId": "{GROUP-ID}",
"id": "{RESTORE-JOB-ID}",
"links": [{
"href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}/clusters/{CLUSTER-NAME}/restoreJobs/{RESTORE-JOB-ID}",
"rel": "self"
}],
"pointInTime": false,
"snapshotId": "{SNAPSHOT-ID}",
"statusName": "FINISHED",
"timestamp": {
"date": "2018-09-15T15:53:00Z",
"increment": 1
}
}
Give Feedback