REST API - POST Microsoft SQL Server Restore Options

Updated

This operation returns the files for the given SQL databases and instance. It also returns a list of SQL instances application to be restored to.

Request

Syntax

POST <webservice>/SQL/RestoreOptions HTTP/1.1
Host: <host name>
Accept:{application/xml | application/json}
Authtoken: <authentication token>
        
    

where <webservice> is the root path used to route the API requests to the Web Server.

For more information, see Available Web Services for REST API.

Request Parameters

Name

Description

Required

restoreDbType

This should be left at zero. This will return the list of SQL instances that can be restored based on the user-defined databases passed in the list and instance version check (SQL restores can be to the same instance version or higher).

Yes

sourceInstanceId

The instance ID of the source instance. If the instance ID is not known, use the GET Instance API to retrieve it.

Yes

selectedDatabases

The list of databases to restore.

Yes

pointInTime

The reference time for the restore.

Valid values are UNIX-style timestamps (seconds since January 1, 1970).

Yes

Request Headers

Name

Description

Host

The host name of the web server.

Accept

The format of the response. Valid values are: application/xml or application/json.

Authtoken

dThe authentication token received after successfully logging on. For details on receiving an authentication token, see Authentication.

Response

Response Parameters

Parameter

Description

Element

fileName

The complete path to the database file.

sqlDbdeviceItem

logicalFileName

The logical name of the database file.

sqlDbdeviceItem

fileMaxSize

The size in bytes of the database that was restored.

sqlDbdeviceItem

databaseId

The system-generated ID assigned to the database.

sqlDBInfo

databaseName

The name of the database.

sqlDBInfo

serverType

The type of the database engine. Valid values are:

  • DataBase Engine

  • Azure DataBase Engine

  • Aws DataBase Engine

  • Azure Managed DataBase Engine

sqlDestinationInstances

clientName

Name if the SQL client.

genericEntity

instanceId

The instance ID for the SQL instance.

genericEntity

clientId

The client ID for the client.

genericEntity

instanceName

The instance name for the SQL instance.

genericEntity

osType

The type of operating system. Valid values are Windows or Unix.

For Azure, Aws, and Azure Managed database engines, the osType is 'Any'.

genericEntity

Examples

Sample Request

POST <webservice>/SQL/RestoreOptions HTTP/1.1
Host: client.mydomain.com
Accept: application/xml
Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6
0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f
8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f
40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7
68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323
3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8
'{
  "restoreDbType": 0,
  "sourceInstanceId": 7,
  "selectedDatabases": [
    {
      "databaseName": "yqpwdh1"
    }
  ]
}'
        
    

Sample Response

{ "sqlDbdeviceItem": [ { "fileName": "C:\\\\Program Files\\\\Microsoft SQL Server\\\\MSSQL11.SQL2012\\\\MSSQL\\\\DATA\\\\1yqpwdh11.ndf", "logicalFileName": "yqpwdh111", "fileMaxSize": 10485760, "id": 0, "sqlDBInfo": { "databaseName": "yqpwdh1", "databaseId": 35 } },  } ], "sqlDestinationInstances": [ { "serverType": "DataBase Engine", "genericEntity": { "clientName": "autosqlspx", "instanceId": 223, "clientId": 170, "instanceName": "AUTOSQLSPX\\\\SQL2012", "_type_": 0, "osType": "Windows" } } ], "error": { "errorMessage": "success", "errorCode": 0 }
}