Navigation

Create One Restore Job for One Cluster

Base URL: https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0

Resource

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

Request Path Parameters

Name Type Description
GROUP-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

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

Name Type Description Default
pretty boolean Indicates whether the response body should be in a prettyprint format. false
envelope boolean

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:

status
HTTP response code
envelope
The expected response body
false

Request Body Parameters

Name Type Description
checkpointId string

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.

Note

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

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

delivery object Method and details of how the restored snapshot data is delivered.
delivery.expires string Conditional: delivery.methodName" : "HTTP". Timestamp in ISO 8601 date and time format in UTC after which the URL is no longer available.
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 string

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

  • AUTOMATED_RESTORE
  • HTTP
  • QUERY

Note

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

  • delivery.targetGroupId 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.

Important

Restore delivery via SCP is a deprecated feature. This feature will be removed in Ops Manager 4.0.

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.

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.

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

Conditional: "delivery.methodName" : "AUTOMATED_RESTORE" for Replica Sets Only. 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.

Note

If you set oplogTs, you:

  • Must set oplogInc.
  • Cannot set checkpointId 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.

oplogInc string

Conditional: "delivery.methodName" : "AUTOMATED_RESTORE" for Replica Sets Only. 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.

Note

If you set oplogInc, you:

  • Must set oplogTs.
  • Cannot set checkpointId 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.

pointInTimeUTCMillis long

Conditional: "delivery.methodName" : "AUTOMATED_RESTORE" for Replica Sets Only. A 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.

Note

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

snapshotId string Conditional: "delivery.methodName" : "HTTP". Unique identifier of the snapshot to restore.

Response

Name Type Description
batchId string Conditional: sharded cluster only. Unique identifier of the batch to which this restore job belongs.
clusterId string Conditional: cluster only. Unique identifier of the cluster that the restore job represents.
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 Conditional: "delivery.methodName" : "HTTP". Number of hours the download URL is valid once the restore job is complete.
delivery.expires string Conditional: "delivery.methodName" : "HTTP". Timestamp in ISO 8601 date and time format in UTC after which the URL is no longer available.
delivery.maxDownloads number Conditional: "delivery.methodName" : "HTTP". 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. Accepted values are:

  • HTTP
  • QUERY

Important

Restore delivery via SCP is a deprecated feature. This feature will be removed in Ops Manager 4.0.

delivery.statusName string

Current status of the downloadable file. Accepted values are:

  • NOT_STARTED
  • IN_PROGRESS
  • READY
  • FAILED
  • INTERRUPTED
  • EXPIRED
  • MAX_DOWNLOADS_EXCEEDED
delivery.targetClusterId string Conditional: delivery.methodName" : "AUTOMATED_RESTORE". Unique identifier of the destination cluster to perform the restore job.
delivery.targetGroupId string Conditional: delivery.methodName" : "AUTOMATED_RESTORE". Unique identifier of the project that contains the destination cluster for the restore job.
delivery.url string Conditional: "delivery.methodName" : "HTTP". URL from which the restored snapshot data can be downloaded.
encryptionEnabled boolean Flag indicating whether the restored snapshot data is encrypted.
groupId string Unique identifier of the group 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.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 present, this value is SHA1.
hostId string Conditional: mirrored config server (SCCC). Unique identifier of the config server to which this restore job belongs.
id string Unique identifier of the restore job.
links object 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 Conditional: "encryptionEnabled" : true. KMIP master key ID used to encrypt the snapshot data.
snapshotId string Unique identifier of the snapshot to restore.
statusName string

Current status of the job. Accepted values are:

  • FINISHED
  • IN_PROGRESS
  • BROKEN
  • KILLED
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 "{USERNAME}:{APIKEY}" --digest \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  --include \
  --request POST "https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0/groups/{GROUP-ID}/clusters/{CLUSTER-NAME}/restoreJobs?pretty=true" \
  --data '
   {
     "delivery" : {
       "expirationHours" : "1",
       "maxDownloads" : "1"
       "methodName" : "HTTP",
       "targetGroupId" : "{TARGET-GROUP-ID}",
       "targetClusterId" : "{TARGET-CLUSTER-ID}"
     },
     "snapshotId" : "{SNAPSHOT-ID}"
   }'

Create an automated restore from an Oplog timestamp. Valid for replica sets only.

curl --user "{USERNAME}:{APIKEY}" --digest \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  --include \
  --request POST "https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0/groups/{GROUP-ID}/clusters/{CLUSTER-NAME}/restoreJobs?pretty=true" \
  --data '
   {
     "delivery" : {
       "methodName" : "AUTOMATED_RESTORE",
       "targetGroupId" : "{TARGET-GROUP-ID}",
       "targetClusterId" : "{TARGET-CLUSTER-ID}"
     },
     "oplogTs" : "1536610288",
     "oplogInc" : "1"
   }'

Create an automated restore from a specific point in time. Valid for replica sets only.

curl --user "{USERNAME}:{APIKEY}" --digest \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  --include \
  --request POST "https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0/groups/{GROUP-ID}/clusters/{CLUSTER-NAME}/restoreJobs?pretty=true" \
  --data '
   {
     "delivery" : {
       "methodName" : "AUTOMATED_RESTORE",
       "targetGroupId" : "{TARGET-GROUP-ID}",
       "targetClusterId" : "{TARGET-CLUSTER-ID}"
     },
     "pointInTimeUTCMillis" : "1536610288000"
   }'

Create an automated restore from a checkpoint. Valid for sharded clusters only.

curl --user "{USERNAME}:{APIKEY}" --digest \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  --include \
  --request POST "https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0/groups/{GROUP-ID}/clusters/{CLUSTER-NAME}/restoreJobs?pretty=true" \
  --data '
   {
     "delivery" : {
       "methodName" : "AUTOMATED_RESTORE",
       "targetGroupId" : "{TARGET-GROUP-ID}",
       "targetClusterId" : "{TARGET-CLUSTER-ID}"
     },
     "checkpointId" : "{CHECKPOINT-ID}"
   }'

Example Responses

Response Header

HTTP/1.1 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
HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}

Response Body

{
  "batchId": "{BATCH-ID}",
  "clusterId": "{CLUSTER-ID}",
  "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://{OPSMANAGER-HOST}:{PORT}/api/public/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
  }
}
{
  "batchId": "{BATCH-ID}",
  "clusterId": "{CLUSTER-ID}",
  "created": "2018-09-20T15:01:00Z",
  "delivery": {
    "methodName": "HTTP",
    "statusName": "READY"
  },
  "encryptionEnabled": false,
  "groupId": "{GROUP-ID}",
  "id": "{RESTORE-JOB-ID}",
  "links": [{
    "href": "https://{OPSMANAGER-HOST}:{PORT}/api/public/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
  }
}
{
  "batchId": "{BATCH-ID}",
  "clusterId": "{CLUSTER-ID}",
  "created": "2018-09-20T15:02:00Z",
  "delivery": {
    "methodName": "HTTP",
    "statusName": "READY"
  },
  "encryptionEnabled": false,
  "groupId": "{GROUP-ID}",
  "id": "{RESTORE-JOB-ID}",
  "links": [{
    "href": "https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0/groups/{GROUP-ID}/clusters/{CLUSTER-NAME}/restoreJobs/{RESTORE-JOB-ID}",
    "rel": "self"
  }],
  "snapshotId": "{SNAPSHOT-ID}",
  "statusName": "FINISHED",
  "timestamp": {
    "date": "2018-09-15T15:53:00Z",
    "increment": 1
  }
}
{
  "batchId": "{BATCH-ID}",
  "clusterId": "{CLUSTER-ID}",
  "created": "2018-09-20T15:03:00Z",
  "delivery": {
    "methodName": "HTTP",
    "statusName": "READY"
  },
  "encryptionEnabled": false,
  "groupId": "{GROUP-ID}",
  "id": "{RESTORE-JOB-ID}",
  "links": [{
    "href": "https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0/groups/{GROUP-ID}/clusters/{CLUSTER-NAME}/restoreJobs/{RESTORE-JOB-ID}",
    "rel": "self"
  }],
  "snapshotId": "{SNAPSHOT-ID}",
  "statusName": "FINISHED",
  "timestamp": {
    "date": "2018-09-15T15:53:00Z",
    "increment": 1
  }
}