Navigation

Create One Restore Job

Creates one restore job for the specified cluster.

This endpoint does not support the following:

  • Delivering restored snapshots by SCP
  • Creating point-in-time restore jobs
  • Creating checkpoint restore jobs for sharded clusters with the HTTP delivery method
  • Creating restore jobs for queryable backup snapshots

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.

The Atlas API uses HTTP Digest Authentication. Provide your Atlas username and API key as the username and password when constructing the HTTP request.

For complete documentation on configuring API access for an Atlas project, see Configure Atlas API Access.

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

Resource

POST /groups/{GROUP-ID}/clusters/{CLUSTER-NAME}/restoreJobs

Request Parameters

Request Path Parameters

Path Element Required/Optional Description
GROUP-ID Required. The unique identifier of the project that owns the snapshots.
CLUSTER-NAME Required The name of the cluster that contains the snapshots that you want to retrieve.

Request Query Parameters

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

Name Type Description Default
pageNum integer Page number (1-based). 1
itemsPerPage integer Maximum number of items to return, up to a maximum of 100. 100
pretty boolean Display response in a prettyprint format. false
envelope boolean Specifies whether or not to wrap the response in an envelope. false

Request Body Parameters

Name Type Description
delivery object The method and details of how the restored snapshot data will be delivered.
delivery.expirationHours number

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

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

delivery.maxDownloads number

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

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

delivery.methodName string

How the data will be delivered. Value may be one of the following:

  • AUTOMATED_RESTORE
  • HTTP

Note

If you specify AUTOMATED_RESTORE, you must also include the delivery.targetGroupId parameter and either the delivery.targetClusterName or delivery.targetClusterId parameter in the request body. 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 ObjectId

The 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.

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 The name of the target cluster.
delivery.targetGroupId ObjectId The unique identifer of the group that contains the target cluster. For use only with the automated restore jobs.
snapshotId ObjectId ID of the snapshot to restore.

Response

Name Type Description
batchId string

ID of the batch to which this restore job belongs.

Only present for a restore of a sharded cluster.

clusterId string

ID of the cluster represented by the restore job.

Only present for a restore of a cluster.

created timestamp The exact point in time when the restore job was requested in ISO 8601 date and time format in UTC.
delivery object The method and details of how the restored snapshot data shall be delivered.
delivery.expires timestamp

Date after which the URL is no longer available.

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

delivery.expirationHours number

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

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

delivery.maxDownloads number

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

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

delivery.methodName string

How the data will be delivered. Value may be one of the following:

  • HTTP
  • QUERY
delivery.statusName string

Current status of the downloadable file. Value may be one of the following:

  • NOT_STARTED
  • IN_PROGRESS
  • READY
  • FAILED
  • INTERRUPTED
  • EXPIRED
  • MAX_DOWNLOADS_EXCEEDED
delivery.url string

The URL from which the restored snapshot data can be downloaded.

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

encryptionEnabled boolean Indicates whether the restored snapshot data is encrypted.
groupId string ID of the project that owns the restore job.
hashes object 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.

Note

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

hashes.typeName string The hashing algorithm used to compute the hash value. If present, this value is SHA1.
hashes.fileName string The name of the file that has been hashed.
hashes.hash string The hash of the file.
id ObjectId The ID of the restore job.
links document array One or more links to sub-resources and/or related resources. The relations between URLs are explained in the Web Linking Specification
masterKeyUUID string The KMIP master key ID used to encrypt the snapshot data. This field is present only if encryptionEnabled is true for the snapshot.
snapshotId ObjectId ID of the snapshot to restore.
statusName string

Current status of the job. Value may be one of the following:

  • FINISHED
  • IN_PROGRESS
  • BROKEN
  • KILLED
timestamp object Timestamp of the latest oplog entry in the restored snapshot.
timestamp.date timestamp Timestamp in ISO 8601 date and time format in UTC of the latest oplog entry in the restored snapshot.
timestamp.increment number 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 "{USERNAME}:{APIKEY}" --digest \
   --header "Accept: application/json" \
   --header "Content-Type: application/json" \
   --include \
   --request POST "https://cloud.mongodb.com/api/atlas/v1.0/groups/6b99999887d9d61443b41657/clusters/Cluster0/restoreJobs?pretty=true" \
   --data '
    {
      "delivery" : {
        "methodName" : "HTTP"
      },
      "snapshotId" : "5a681ff180eef54e09de20d1"
    }'

Example Response

{
  "links": [
    {
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/6b99999887d9d61443b41657/clusters/Cluster0/restoreJobs?batchId=5a69049d87d9d62a94d01adc",
      "rel": "self"
    }
  ],
  "results": [
    {
      "batchId": "5a69049d87d9d62a94d01adc",
      "clusterId": "6c66689487d9d61443b46150",
      "clusterName": "Cluster0",
      "created": "2018-01-24T22:11:41Z",
      "delivery": {
        "expirationHours": 1,
        "maxDownloads": 1,
        "methodName": "HTTP",
        "statusName": "NOT_STARTED"
      },
      "encryptionEnabled": false,
      "groupId": "6b99999887d9d61443b41657",
      "id": "5a69049d87d9d62a94d01add",
      "links": [
        {
          "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/6b99999887d9d61443b41657/clusters/Cluster0/restoreJobs/5a69049d87d9d62a94d01add",
          "rel": "self"
        }
      ],
      "pointInTime": false,
      "snapshotId": "5a682026e2bfb30d6616ae54",
      "statusName": "IN_PROGRESS",
      "timestamp": {
        "date": "2018-01-24T05:55:03Z",
        "increment": 1
      }
    },
    {
      "batchId": "5a69049d87d9d62a94d01adc",
      "clusterId": "6c66689487d9d61443b46150",
      "clusterName": "Cluster0",
      "created": "2018-01-24T22:11:41Z",
      "delivery": {
        "expirationHours": 1,
        "maxDownloads": 1,
        "methodName": "HTTP",
        "statusName": "NOT_STARTED"
      },
      "encryptionEnabled": false,
      "groupId": "6b99999887d9d61443b41657",
      "id": "5a69049d87d9d62a94d01ade",
      "links": [
        {
          "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/6b99999887d9d61443b41657/clusters/Cluster0/restoreJobs/5a69049d87d9d62a94d01ade",
          "rel": "self"
        }
      ],
      "pointInTime": false,
      "snapshotId": "5a682028fcc17841e4d5851g",
      "statusName": "IN_PROGRESS",
      "timestamp": {
        "date": "2018-01-24T05:55:03Z",
        "increment": 1
      }
    },
    {
      "batchId": "5a69049d87d9d62a94d01adc",
      "clusterId": "5a66689487d9d61443b46149",
      "clusterName": "Cluster0",
      "created": "2018-01-24T22:11:41Z",
      "delivery": {
        "expirationHours": 1,
        "maxDownloads": 1,
        "methodName": "HTTP",
        "statusName": "NOT_STARTED"
      },
      "encryptionEnabled": false,
      "groupId": "6b99999887d9d61443b41657",
      "id": "5a69049d87d9d62a94d01adf",
      "links": [
        {
          "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/6b99999887d9d61443b41657/clusters/Cluster0/restoreJobs/5a69049d87d9d62a94d01adf",
          "rel": "self"
        }
      ],
      "pointInTime": false,
      "snapshotId": "5a682026e2bfb30d161c3859",
      "statusName": "IN_PROGRESS",
      "timestamp": {
        "date": "2018-01-24T05:55:03Z",
        "increment": 1
      }
    }
  ],
  "totalCount": 3
}