Navigation

Create a Cloud Backup Restore Job

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.

Important With Circle IconCreated with Sketch.Important

If you specify "deliveryType" : "automated" or "deliveryType" : "pointInTime" in your request body to create an automated restore job, 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}/backup/restoreJobs/
Path Parameter
Type
Necessity
Description
GROUP-ID
string
Required
Unique identifier of the project for the Atlas cluster whose snapshot you want to restore.
SOURCE-CLUSTER-NAME
string
Required
Name of the Atlas cluster whose snapshot you want to restore.

This endpoint might use any of the HTTP request query parameters available to all Atlas API resources. All of these are optional.

Name
Type
Necessity
Description
Default
pretty
boolean
Optional
Flag indicating whether the response body should be in a prettyprint format.
false
envelope
boolean
Optional

Flag indicating if Atlas should wrap the response in a JSON envelope.

This option may be needed for some API clients. These clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query.

For endpoints that return one result, the response body includes:

status
HTTP response code
envelope
Expected response body
false

The request body, response body, and examples depend on the type of restore:

Body Parameter
Type
Necessity
Description
deliveryType
string
Required

Type of restore job to create. Accepted values include:

Job Type
Action
automated
Atlas restores the snapshot corresponding to the snapshotId to the Atlas cluster corresponding to the name targetClusterName in the Atlas project corresponding to the targetGroupId.
download

Atlas generates and displays a URL to download a .tar.gz of the snapshot corresponding to the snapshotId. The contents of the tar.gz archive contain the data files for your Atlas cluster.

Bulb IconTip
See also:

To learn more about manually restoring the downloaded data files, see Procedure.

Info With Circle IconCreated with Sketch.Note
Download Limitations

Each cloud backup can have one download at a time, and each project can have a maximum of 20 downloads at a time.

pointInTime
snapshotId
string
Required
Unique identifier of the snapshot to restore.
target
ClusterName
string
Required
Name of the target Atlas cluster to which the restore job restores the snapshot.
target
GroupId
string
Required
Unique identifier of the target Atlas project for the specified targetClusterName.
Name
Type
Description
cancelled
boolean
Flag indicating whether the restore job was canceled.
createdAt
string
Timestamp in ISO 8601 date and time format in UTC when Atlas created the restore job.
deliveryType
string

Type of restore job to create. Atlas may return:

Job Type
Action
automated
Atlas restores the snapshot corresponding to the snapshotId to the Atlas cluster corresponding to the name targetClusterName in the Atlas project corresponding to the targetGroupId.
download

Atlas generates and displays a URL to download a .tar.gz of the snapshot corresponding to the snapshotId. The contents of the tar.gz archive contain the data files for your Atlas cluster.

Bulb IconTip
See also:

To learn more about manually restoring the downloaded data files, see Procedure.

Info With Circle IconCreated with Sketch.Note
Download Limitations

Each cloud backup can have one download at a time, and each project can have a maximum of 20 downloads at a time.

pointInTime
expired
boolean
Flag indicating whether the restore job expired.
expiresAt
integer
Timestamp in ISO 8601 date and time format in UTC when the restore job expires.
finishedAt
integer
Timestamp in ISO 8601 date and time format in UTC when the restore job completed.
id
string
Unique identifier of the restore job.
links
array of objects

One or more links to sub-resources and/or related resources. The relation-types between URL s are explained in the Web Linking Specification.

snapshotId
string
Unique identifier of the source snapshot ID of the restore job.
targetGroupId
string
Name of the target Atlas project of the restore job.
targetClusterName
string
Name of the target Atlas cluster to which the restore job restores the snapshot.
timestamp
string
Timestamp in ISO 8601 date and time format in UTC when the snapshot associated to snapshotId was taken.
1curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest --include \
2 --header "Accept: application/json" \
3 --header "Content-Type: application/json" \
4 --request POST "https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}/clusters/{SOURCE-CLUSTER-NAME}/backup/restoreJobs" \
5 --data '{
6 "snapshotId" : "{SNAPSHOT-ID}",
7 "deliveryType" : "automated",
8 "targetClusterName" : "{TARGET-CLUSTER-NAME}",
9 "targetGroupId" : "{TARGET-GROUP-ID}"
10 }'
1{
2 "cancelled": false,
3 "deliveryType": "automated",
4 "expired": false,
5 "expiresAt": "2020-05-04T16:25:01Z",
6 "id": "{RESTORE-ID}",
7 "links": [
8 {
9 "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}/clusters/{SOURCE-CLUSTER-NAME}/backup/restoreJobs/{RESTORE-ID}",
10 "rel": "self"
11 },
12 {
13 "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}/clusters/{SOURCE-CLUSTER-NAME}/backup/snapshots/{SNAPSHOT-ID}",
14 "rel": "http://mms.mongodb.com/snapshot"
15 },
16 {
17 "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}/clusters/{SOURCE-CLUSTER-NAME}",
18 "rel": "http://mms.mongodb.com/cluster"
19 },
20 {
21 "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}",
22 "rel": "http://mms.mongodb.com/group"
23 }
24 ],
25 "snapshotId": "{SNAPSHOT-ID}",
26 "targetClusterName": "{TARGET-CLUSTER-NAME}",
27 "targetGroupId": "{TARGET-GROUP-ID}",
28 "timestamp": "2020-05-03T16:25:01Z"
29}
Give Feedback