Create One Restore Job for One Cluster
On this page
- OAuth 2.0 authentication for programmatic access to Cloud Manager is available as a Preview feature.
- The feature and the corresponding documentation might change at any time during the Preview period. To use OAuth 2.0 authentication, create a service account to use in your requests to the Cloud Manager Public API.
Base URL: https://cloud.mongodb.com/api/public/v1.0
Resource
POST /groups/{PROJECT-ID}/clusters/{CLUSTER-ID}/restoreJobs
Request Path Parameters
Name | Type | Description |
---|---|---|
PROJECT-ID | string | Unique identifier of the project that owns the job. |
CLUSTER-ID | string | Unique identifier of the cluster that the job represents. |
Request Query Parameters
The following query parameters 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 that indicates whether or not to wrap 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. For endpoints that return one result, the response body includes:
| false |
Request Body Parameters
Name | Type | Necessity | Description |
---|---|---|---|
delivery | object | Required | Method and details of how the restored snapshot data
is delivered. |
delivery .expires | string | Conditional | Timestamp in ISO 8601 date and time format in UTC after which the URL is no longer available. If you set |
delivery .expirationHours | number | Conditional | Number of hours the download URL is valid once the restore job is complete. If you set |
delivery .maxDownloads | number | Required | Number of times the download URL can be used. This must be
1 or greater. |
delivery .methodName | string | Required | Means by which Cloud Manager delivers the data. Set to HTTP . |
snapshotId | string | Required | Unique identifier of the snapshot to restore. |
Note
Condition
If you set "delivery.methodName" :
AUTOMATED_RESTORE"
, you must set
delivery.targetGroupId
and
delivery.targetClusterId
.
Create an automated restore from a snapshot.
Name | Type | Necessity | Description |
---|---|---|---|
delivery | object | Required | Method and details of how the restored snapshot data
is delivered. |
delivery .methodName | string | Required | Means by which Cloud Manager delivers the data. Set to
The response shows the IMPORTANT: Restore delivery via SCP has been removed as of March 27, 2018. |
delivery .targetClusterId | string | Required | Unique identifier of the target cluster. Use the If backup is not enabled on the target cluster, the
Get All Snapshots
endpoint returns an empty |
delivery .targetGroupId | string | Required | Unique identifier of the project that contains the destination
cluster for the restore job. |
snapshotId | string | Required | Unique identifier of the snapshot to restore. |
Create an automated restore from an Oplog timestamp.
Oplog Restores work with Replica Sets using any MongoDB
version or Sharded Clusters using FCV
4.2 or
later.
Name | Type | Necessity | Description |
---|---|---|---|
delivery | object | Required | Method and details of how the restored snapshot data
is delivered. |
delivery .methodName | string | Required | Means by which Cloud Manager delivers the data. Set to
The response shows the IMPORTANT: Restore delivery via SCP has been removed as of March 27, 2018. |
delivery .targetClusterId | string | Required | Unique identifier of the target cluster. Use the If backup is not enabled on the target cluster, the
Get All Snapshots
endpoint returns an empty |
delivery .targetGroupId | string | Required | Unique identifier of the project that contains the destination
cluster for the restore job. |
oplogTs | string | Required | Oplog timestamp given as a
Timestamp in the number of seconds that have elapsed since the UNIX epoch. When paired with Run a query against If you provide this setting, this endpoint restores all data up
to and including this Oplog timestamp to the database you
specified in the |
oplogInc | string | Required | 32-bit incrementing ordinal that represents operations within a
given second. When paired with If you provide this setting, this endpoint restores all data up
to and including this Oplog timestamp to the database you
specified in the |
Create an automated restore from a specific point in time.
PIT Restores work with Replica Sets using any MongoDB
version or Sharded Clusters using FCV
4.2 or
later.
Name | Type | Necessity | Description |
---|---|---|---|
delivery | object | Required | Method and details of how the restored snapshot data
is delivered. |
delivery .methodName | string | Required | Means by which Cloud Manager delivers the data. Set to
The response shows the IMPORTANT: Restore delivery via SCP has been removed as of March 27, 2018. |
delivery .targetClusterId | string | Required | Unique identifier of the target cluster. Use the If backup is not enabled on the target cluster, the
Get All Snapshots
endpoint returns an empty |
delivery .targetGroupId | string | Required | Unique identifier of the project that contains the destination
cluster for the restore job. |
pointInTimeUTCMillis | long | Required | 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 |
Create an automated restore from a checkpoint. Checkpoint
restores work for
sharded clusters running MongoDB
clusters with FCV
4.0 or earlier.
Important
Don't use checkpoint restores for MongoDB clusters with FCV 4.2 or later.
Name | Type | Necessity | Description |
---|---|---|---|
checkpointId | string | Required | Unique identifier for the sharded cluster checkpoint that represents the point in time to which your data will be restored. If you provide this setting, this endpoint restores all data up
to this checkpoint to the database you
specified in the |
delivery | object | Required | Method and details of how the restored snapshot data
is delivered. |
delivery .methodName | string | Required | Means by which Cloud Manager delivers the data. Set to
The response shows the |
delivery .targetClusterId | string | Required | Unique identifier of the target cluster. Use the If backup is not enabled on the target cluster, the
Get All Snapshots
endpoint returns an empty |
delivery .targetGroupId | string | Required | Unique identifier of the project that contains the destination
cluster for the restore job. |
Response
Response Document
The response JSON document includes an array of result objects, an array of link objects and a count of the total number of result objects retrieved.
Name | Type | Description |
---|---|---|
results | array | Array includes one object for each item detailed in the
results Embedded Document section. |
links | array | Array includes one or more links to sub-resources
and/or related resources. The relations between URLs are
explained in the Web Linking Specification. |
totalCount | number | Integer count of the total number of items in the result set. It
may be greater than the number of objects in the
results array if the entire result set is paginated. |
results
Embedded Document
Each result is one cluster restore job. This array includes one restore job only.
Name | Type | Description |
---|---|---|
batchId | string | Unique identifier of the batch to which this restore
job belongs. Returned if snapshot was from a sharded cluster. |
clusterId | string | Unique identifier of the cluster that the restore job
represents. Returned if snapshot was from a replica set or
sharded cluster. |
created | string | Timestamp in ISO 8601 date and time format in UTC when the restore job was requested. |
delivery | object | Method and details of how the restored snapshot data
is delivered. |
delivery .expirationHours | number | Number of hours the download URL is valid once the restore
job is complete. |
delivery .expires | string | |
delivery .maxDownloads | number | Number of times the download URL can be used. This must be
1 or greater. |
delivery .methodName | string | Means by which the data is delivered. Returns HTTP . |
delivery .statusName | string | Current status of the downloadable file. Accepted values are:
|
delivery .url | string | URL from which the restored snapshot data can be
downloaded. |
encryptionEnabled | boolean | Flag indicating if the snapshot was encrypted. |
groupId | string | Unique identifier of the group that owns the restore
job. |
hashes | array of objects | If the corresponding delivery.url has been downloaded, this
array returns a single object that represents the hash of
the .tar.gz file. |
hashes .fileName | string | Name of the snapshot file that has been hashed. |
hashes .hash | string | Hash of the snapshot file. |
hashes .typeName | string | Hashing algorithm used to compute the hash value. If returned,
value is set to SHA1 . |
hostId | string | Unique identifier of the config server to which this
restore job belongs. Returned if config server was a
SCCC. |
id | string | Unique identifier of the restore job. |
links | array of objects | One or more links to sub-resources and/or related resources. All
|
masterKeyUUID | string | |
pointInTime | boolean | Flag indicating if the snapshot was from a point in time. |
snapshotId | string | Unique identifier of the snapshot to restore. |
statusName | string | Current status of the job. Accepted values are:
|
timestamp | object | Timestamp of the Oplog entry when the snapshot was created. |
timestamp .date | string | Timestamp in ISO 8601 date and time format in UTC of the latest oplog entry in the restored
snapshot. |
timestamp .increment | string | Order of all operations completed at the latest oplog entry in
the restored snapshot. |
Name | Type | Description |
---|---|---|
batchId | string | Unique identifier of the batch to which this restore
job belongs. Returned if snapshot was from a sharded cluster. |
clusterId | string | Unique identifier of the cluster that the restore job
represents. Returned if snapshot was from a replica set or
sharded cluster. |
created | string | Timestamp in ISO 8601 date and time format in UTC when the restore job was requested. |
delivery | object | Method and details of how the restored snapshot data
is delivered. |
delivery .methodName | string | Means by which the data is delivered. Returns HTTP . |
delivery .targetClusterId | string | Unique identifier of the destination cluster to perform the
restore job. |
delivery .targetGroupId | string | Unique identifier of the project that contains the
destination cluster for the restore job. |
encryptionEnabled | boolean | Flag indicating if the snapshot was encrypted. |
groupId | string | Unique identifier of the group that owns the restore
job. |
hostId | string | Unique identifier of the config server to which this
restore job belongs. Returned if config server was a
SCCC. |
id | string | Unique identifier of the restore job. |
links | object array | One or more links to sub-resources and/or related resources. All
|
masterKeyUUID | string | |
pointInTime | boolean | Flag indicating if the snapshot was from a point in time. |
snapshotId | string | Unique identifier of the snapshot to restore. |
statusName | string | Current status of the job. Accepted values are:
|
timestamp | object | Timestamp of the Oplog entry when the snapshot was created. |
timestamp .date | string | Timestamp in ISO 8601 date and time format in UTC of the latest oplog entry in the restored
snapshot. |
timestamp .increment | string | Order of all operations completed at the latest oplog entry in
the restored snapshot. |
Name | Type | Description |
---|---|---|
batchId | string | Unique identifier of the batch to which this restore
job belongs. Returned if snapshot was from a sharded cluster. |
clusterId | string | Unique identifier of the cluster that the restore job
represents. Returned if snapshot was from a replica set or
sharded cluster. |
created | string | Timestamp in ISO 8601 date and time format in UTC when the restore job was requested. |
delivery | object | Method and details of how the restored snapshot data
is delivered. |
delivery .methodName | string | Means by which the data is delivered. Returns HTTP . |
delivery .targetClusterId | string | Unique identifier of the destination cluster to perform the
restore job. |
delivery .targetGroupId | string | Unique identifier of the project that contains the
destination cluster for the restore job. |
encryptionEnabled | boolean | Flag indicating if the snapshot was encrypted. |
groupId | string | Unique identifier of the group that owns the restore
job. |
hostId | string | Unique identifier of the config server to which this
restore job belongs. Returned if config server was a
SCCC. |
id | string | Unique identifier of the restore job. |
links | object array | One or more links to sub-resources and/or related resources. All
|
masterKeyUUID | string | |
pointInTime | boolean | Flag indicating if the snapshot was from a point in time. |
snapshotId | string | Unique identifier of the snapshot to restore. |
statusName | string | Current status of the job. Accepted values are:
|
timestamp | object | Timestamp of the Oplog entry when the snapshot was created. |
timestamp .date | string | Timestamp in ISO 8601 date and time format in UTC of the latest oplog entry in the restored
snapshot. |
timestamp .increment | string | Order of all operations completed at the latest oplog entry in
the restored snapshot. |
Name | Type | Description |
---|---|---|
batchId | string | Unique identifier of the batch to which this restore
job belongs. Returned if snapshot was from a sharded cluster. |
clusterId | string | Unique identifier of the cluster that the restore job
represents. Returned if snapshot was from a replica set or
sharded cluster. |
created | string | Timestamp in ISO 8601 date and time format in UTC when the restore job was requested. |
delivery | object | Method and details of how the restored snapshot data
is delivered. |
delivery .methodName | string | Means by which the data is delivered. Returns HTTP . |
delivery .targetClusterId | string | Unique identifier of the destination cluster to perform the
restore job. |
delivery .targetGroupId | string | Unique identifier of the project that contains the
destination cluster for the restore job. |
encryptionEnabled | boolean | Flag indicating if the snapshot was encrypted. |
groupId | string | Unique identifier of the group that owns the restore
job. |
hostId | string | Unique identifier of the config server to which this
restore job belongs. Returned if config server was a
SCCC. |
id | string | Unique identifier of the restore job. |
links | object array | One or more links to sub-resources and/or related resources. All
|
masterKeyUUID | string | |
pointInTime | boolean | Flag indicating if the snapshot was from a point in time. |
snapshotId | string | Unique identifier of the snapshot to restore. |
statusName | string | Current status of the job. Accepted values are:
|
timestamp | object | Timestamp of the Oplog entry when the snapshot was created. |
timestamp .date | string | Timestamp in ISO 8601 date and time format in UTC of the latest oplog entry in the restored
snapshot. |
timestamp .increment | string | Order of all operations completed at the latest oplog entry in
the restored snapshot. |
Name | Type | Description |
---|---|---|
batchId | string | Unique identifier of the batch to which this restore
job belongs. Returned if snapshot was from a sharded cluster. |
checkpointId | string | Unique identifier for the sharded cluster checkpoint
that represents the point in time to which your data will be
restored. |
clusterId | string | Unique identifier of the cluster that the restore job
represents. Returned if snapshot was from a replica set or
sharded cluster. |
created | string | Timestamp in ISO 8601 date and time format in UTC when the restore job was requested. |
delivery | object | Method and details of how the restored snapshot data
is delivered. |
delivery .methodName | string | Means by which the data is delivered. Returns HTTP . |
delivery .targetClusterId | string | Unique identifier of the destination cluster to perform the
restore job. |
delivery .targetGroupId | string | Unique identifier of the project that contains the
destination cluster for the restore job. |
encryptionEnabled | boolean | Flag indicating if the snapshot was encrypted. |
groupId | string | Unique identifier of the group that owns the restore
job. |
hostId | string | Unique identifier of the config server to which this
restore job belongs. Returned if config server was a
SCCC. |
id | string | Unique identifier of the restore job. |
links | object array | One or more links to sub-resources and/or related resources. All
|
masterKeyUUID | string | |
pointInTime | boolean | Flag indicating if the snapshot was from a point in time. |
statusName | string | Current status of the job. Accepted values are:
|
timestamp | object | Timestamp of the Oplog entry when the snapshot was created. |
timestamp .date | string | Timestamp in ISO 8601 date and time format in UTC of the latest oplog entry in the restored
snapshot. |
timestamp .increment | string | Order of all operations completed at the latest oplog entry in
the restored snapshot. |
Example Request
Create a restore job that transfers a compressed snapshot using HTTP.
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --include \ --request POST "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/clusters/{CLUSTER-ID}/restoreJobs?pretty=true" \ --data ' { "delivery" : { "expirationHours" : "1", "maxDownloads" : "1", "methodName" : "HTTP" }, "snapshotId" : "{SNAPSHOT-ID}" }'
Create an automated restore from a snapshot.
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --request POST "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/clusters/{CLUSTER-ID}/restoreJobs?pretty=true" \ --data ' { "delivery" : { "methodName" : "AUTOMATED_RESTORE", "targetGroupId" : "{TARGET-PROJECT-ID}", "targetClusterId" : "{TARGET-CLUSTER-ID}" }, "snapshotId": "{SNAPSHOT-ID}" }'
Create an automated restore from an Oplog timestamp.
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --include \ --request POST "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/clusters/{CLUSTER-ID}/restoreJobs?pretty=true" \ --data ' { "delivery" : { "methodName" : "AUTOMATED_RESTORE", "targetGroupId" : "{TARGET-PROJECT-ID}", "targetClusterId" : "{TARGET-CLUSTER-ID}" }, "oplogTs" : "1536610288", "oplogInc" : "1" }'
Create an automated restore from a specific point in time.
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --include \ --request POST "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/clusters/{CLUSTER-ID}/restoreJobs?pretty=true" \ --data ' { "delivery" : { "methodName" : "AUTOMATED_RESTORE", "targetGroupId" : "{TARGET-PROJECT-ID}", "targetClusterId" : "{TARGET-CLUSTER-ID}" }, "pointInTimeUTCMillis" : "1536610288000" }'
Create an automated restore from a checkpoint. Valid for sharded clusters running MongoDB clusters with FCV 4.0 or earlier only.
Important
Don't use checkpoint restores for MongoDB clusters with FCV 4.2 or later.
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --include \ --request POST "https://<OpsManagerHost>:<Port>/api/public/v1.0/groups/{PROJECT-ID}/clusters/{CLUSTER-ID}/restoreJobs?pretty=true" \ --data ' { "delivery" : { "methodName" : "AUTOMATED_RESTORE", "targetGroupId" : "{TARGET-PROJECT-ID}", "targetClusterId" : "{TARGET-CLUSTER-ID}" }, "checkpointId" : "{CHECKPOINT-ID}" }'
Example Responses
Response Header
401 Unauthorized Content-Type: application/json;charset=ISO-8859-1 Date: {dateInUnixFormat} WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false Content-Length: {requestLengthInBytes} Connection: keep-alive
200 OK Vary: Accept-Encoding Content-Type: application/json Strict-Transport-Security: max-age=300 Date: {dateInUnixFormat} Connection: keep-alive Content-Length: {requestLengthInBytes} X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}
Response Body
{ "links" : [ { "href" : "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/clusters/{CLUSTER-ID}/restoreJobs?pretty=true&pageNum=1&itemsPerPage=100", "rel" : "self" } ], "results" : [ { "batchId": "{BATCH-ID}", "clusterId": "{CLUSTER-ID}", "created": "2018-09-20T15:00:00Z", "delivery": { "expirationHours": 1, "maxDownloads": 1, "methodName": "HTTP", "statusName": "READY" }, "encryptionEnabled": false, "groupId": "{PROJECT-ID}", "id": "{RESTORE-JOB-ID}", "links": [{ "href": "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-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 } }], "totalCount" : 1 }
{ "links" : [ { "href" : "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/clusters/{CLUSTER-ID}/restoreJobs?pretty=true&pageNum=1&itemsPerPage=100", "rel" : "self" } ], "results" : [ { "batchId" : "{BATCH-ID}", "clusterId" : "{CLUSTER-ID}", "created" : "2020-04-21T03:49:57Z", "delivery" : { "expirationHours" : 1, "expires" : "2020-04-21T04:49:57Z", "maxDownloads" : 1, "methodName" : "HTTP", "statusName" : "READY", "url" : "https://api-backup.mongodb.com/backup/restore/v2/pull/{JOB-ID}/OTY0ZmFiNmEzZjEzNGUyMTlhZjJjNjM3NGMyNGM4ZTM=/electron_0-1492636465-{JOB-ID}.tar.gz" }, "encryptionEnabled" : false, "groupId" : "{PROJECT-ID}", "id" : "{JOB-ID}", "links" : [ { "href" : "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/clusters/{CLUSTER-ID}/restoreJobs/{JOB-ID}", "rel" : "self" } ], "snapshotId" : "{SNAPSHOT-ID}", "statusName" : "FINISHED", "timestamp" : { "date" : "2020-04-18T15:14:25Z", "increment" : 1 } } ], "totalCount" : 1 }
{ "links" : [ { "href" : "https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0/groups/{PROJECT-ID}/clusters/{CLUSTER-ID}/restoreJobs?pretty=true&pageNum=1&itemsPerPage=100", "rel" : "self" } ], "results" : [ { "batchId": "{BATCH-ID}", "clusterId": "{CLUSTER-ID}", "created": "2018-09-20T15:01:00Z", "delivery": { "methodName": "HTTP", "statusName": "READY" }, "encryptionEnabled": false, "groupId": "{PROJECT-ID}", "id": "{RESTORE-JOB-ID}", "links": [{ "href": "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-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 } } ], "totalCount" : 1 }
{ "links" : [ { "href" : "https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0/groups/{PROJECT-ID}/clusters/{CLUSTER-ID}/restoreJobs?pretty=true&pageNum=1&itemsPerPage=100", "rel" : "self" } ], "results" : [ { "batchId": "{BATCH-ID}", "clusterId": "{CLUSTER-ID}", "created": "2018-09-20T15:02:00Z", "delivery": { "methodName": "HTTP", "statusName": "READY" }, "encryptionEnabled": false, "groupId": "{PROJECT-ID}", "id": "{RESTORE-JOB-ID}", "links": [{ "href": "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/clusters/{CLUSTER-NAME}/restoreJobs/{RESTORE-JOB-ID}", "rel": "self" }], "snapshotId": "{SNAPSHOT-ID}", "statusName": "FINISHED", "timestamp": { "date": "2018-09-15T15:53:00Z", "increment": 1 } } ], "totalCount" : 1 }
{ "links" : [ { "href" : "https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0/groups/{PROJECT-ID}/clusters/{CLUSTER-ID}/restoreJobs?pretty=true&pageNum=1&itemsPerPage=100", "rel" : "self" } ], "results" : [ { "batchId": "{BATCH-ID}", "clusterId": "{CLUSTER-ID}", "created": "2018-09-20T15:03:00Z", "delivery": { "methodName": "HTTP", "statusName": "READY" }, "encryptionEnabled": false, "groupId": "{PROJECT-ID}", "id": "{RESTORE-JOB-ID}", "links": [{ "href": "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/clusters/{CLUSTER-NAME}/restoreJobs/{RESTORE-JOB-ID}", "rel": "self" }], "snapshotId": "{SNAPSHOT-ID}", "statusName": "FINISHED", "timestamp": { "date": "2018-09-15T15:53:00Z", "increment": 1 } } ], "totalCount" : 1 }