This is an archive version of the document. To get the most up-to-date information, see the current version.

Creating Backup Policy

This section explains how to create a new backup policy.

Request

POST https://<hostname>/api/v1/policies

Request Headers

The request header must contain an authorization token of the current session.

Request Parameters

None.

Request Body

Property

Type

Description

name

string

Sets the name of the backup policy.

description

string

Sets the description of the backup policy.

isEnabled

boolean

Defines if the backup policy must be enabled upon creation.

priority

integer

Sets the priority for the backup policy.

tenantId

string

Sets the tenant identification number.

backupType

string

Sets the backup type.

regions

string

Sets the regions in which to look up resources.

selectedItems

string

Sets the selected items. Possible types:

  • subscriptions
  • resourceGroups
  • tags
  • virtualMachines

excludedItems

string

Sets the selected items.

snapshotSettings

PolicySnapshotSettingsFromClient Object

Sets the PolicySnapshotSettingsFromClient object.

backupSettings

PolicyBackupSettingsFromClient Object

Sets the PolicyBackupSettingsFromClient object.

retrySettings

RetrySettings Object

Sets the RetrySettings object.

policyNotificationSettings

PolicyNotificationSettings Object

Sets the PolicyNotificationSettings object.

PolicySnapshotSettingsFromClient Object

Property

Type

Description

generationsToSave

integer

Sets the number of snapshots to be saved by the backup policy.

schedule

integer

Sets schedule parameters.

PolicyBackupSettingsFromClient Object

Property

Type

Description

targetRepositoryId

integer

Sets the identification number of the backup repository to which backups are going to be saved.

retentionSettings

RepositoryRetentionSettings Object

Sets the RepositoryRetentionSettings object.

schedule

string

Sets schedule parameters.

RetrySettings Object

Property

Type

Description

retryCount

integer

Sets the retry attempts number.

PolicyNotificationSettings Object

Property

Type

Description

recipient

string

Sets the email address to which notifications about backup policy results muse be sent.

notifyOnSuccess

boolean

Defines if a notification must be sent on Success.

notifyOnWarning

boolean

Defines if a notification must be sent on Warning.

notifyOnFailure

boolean

Defines if a notification must be sent on Failure.

Request Example

Request:

POST https://<hostname>/api/v1/policies/

 

Request Header:

Authorization: Bearer <Access-Token>

 

Request Body:

{

  "name":"Backup Policy via REST",

  "description":"",

  "isEnabled":true,

  "priority":0,

  "tenantId":"3e924ba9-93bc-40d5-8a47-33f07b239a52",

  "backupType":"SelectedItems",

  "regions":[

     {

        "regionId":"northeurope"

     },

     {

        "regionId":"ukwest"

     },

     {

        "regionId":"westeurope"

     }

  ],

  "selectedItems":{

     "subscriptions":[

 

     ],

     "resourceGroups":[

 

     ],

     "tags":[

 

     ],

     "virtualMachines":[

        {

           "id":"ej43ifg58cgjs8e9cod74ye6cbwm5nttf6ijzk64rshqoip1abqy"

        },

        {

           "id":"g344t5o8hgxgyp9r5bxqsn1aom88kjsc3hjnk3o8umzdptc3w3ey"

        }

     ]

  },

  "excludedItems":{

     "virtualMachines":[

        {

           "id":"g344t5o8hgxgyp9r5bxqsn1aom88kjsc3hjnk3o8umzdptc3w3ey"

        }

     ]

  },

  "snapshotSettings":{

     "generationsToSave":7,

     "schedule":{

        "frequencyType":"Monthly",

        "monthlyTime":"20:00:00",

        "monthlyType":"First",

        "monthlyDayOfWeek":"Monday",

        "monthlyLastDay":false,

        "monthlyDay":1,

        "selectedMonths":[

           "January",

           "February",

           "March",

           "April",

           "May",

           "June",

           "July",

           "August",

           "September",

           "October",

           "November",

           "December"

        ]

     }

  },

  "backupSettings":{

     "targetRepositoryId":1,

     "retentionSettings":{

        "retentionDurationType":"Daily",

        "timeRetentionDuration":21

     },

     "schedule":{

        "frequencyType":"Monthly",

        "monthlyTime":"20:00:00",

        "monthlyType":"First",

        "monthlyDayOfWeek":"Monday",

        "monthlyLastDay":false,

        "monthlyDay":1,

        "selectedMonths":[

           "January",

           "February",

           "March",

           "April",

           "May",

           "June",

           "July",

           "August",

           "September",

           "October",

           "November",

           "December"

        ]

     }

  },

  "retrySettings":{

     "retryCount":3

  },

  "policyNotificationSettings":{

     "recipient":"@tech.local",

     "notifyOnSuccess":true,

     "notifyOnWarning":true,

     "notifyOnFailure":true

  }

}

Response

The server returns the following response to the client.

Response Codes

A successfully completed operation returns a response code 200 (OK).

Response Headers

The response to this request contains the following headers. The response may also include additional standard HTTPS headers.

Header

Description

Content-length

The length of the response body.

Content-type

The media type and syntax of the response body message: application/json; charset=utf-8

Response Body

Property

Type

Description

id

string

Shows the identification number of the backup policy.

priority

integer

Shows the priority.

snapshotSettings

PolicySnapshotSettings Object

Contains the PolicySnapshotSettings object.

backupSettings

PolicyBackupSettings Object

Contains the PolicyBackupSettings object.

excludedItemsCount

integer

Shows number excluded items.

usn

integer

Shows the version of the backup policy. Used by platform services to detect if a backup policy has been hanged since the last sync.

_links

Dictionary of string [key] and Object [value]

Links to related resources (navigation property).

name

string

Shows the name of the backup policy.

description

string

Shows the description of the backup policy.

tenantId

string

Shows the identification number of the tenant.

retrySettings

RetrySettings Object

Contains the RetrySettings object.

policyNotificationSettings

PolicyNotificationSettings Object

Contains the PolicyNotificationSettings object.

isEnabled

boolean

Shows if a backup policy is enabled.

backupType

string

Shows a backup type.

PolicySnapshotSettings Object

Property

Type

Description

generationsToSave

integer

Shows the number of snapshots to be saved by the backup policy.

scheduleId

integer

Shows the identification number of the schedule.

PolicyBackupSettings Object

Property

Type

Description

targetRepositoryId

integer

Shows the identification number of the backup repository to which backups are going to be saved.

retentionSettings

RepositoryRetentionSettings Object

Contains the RepositoryRetentionSettings object.

scheduleId

string

Shows the identification number of the schedule.

RepositoryRetentionSettings Object

Property

Type

Description

timeRetentionDuration

integer

Shows how many restore points to keep in the backup repository.

retentionDurationType

string

Shows the method of how to keep backup. Possible values: Daily, Monthly.

RetrySettings Object

Property

Type

Description

retryCount

integer

Shows how many retry attempts are allowed.

PolicyNotificationSettings Object

Property

Type

Description

recipient

string

Shows the email address to which notifications about backup policy results muse be sent.

notifyOnSuccess

boolean

Shows if a notification must be sent on Success.

notifyOnWarning

boolean

Shows if a notification must be sent on Warning.

notifyOnFailure

boolean

Shows if a notification must be sent on Failure.

Response Example

Response:

200 OK

 

Response Body:

{

  "id": "339740af-7075-418c-9638-bc5cc9dfd9ef",

  "priority": 3,

  "snapshotSettings":    {

     "generationsToSave": 7,

     "scheduleId": 9

  },

  "backupSettings":    {

     "targetRepositoryId": 1,

     "retentionSettings":       {

        "timeRetentionDuration": 21,

        "retentionDurationType": "Daily"

     },

     "scheduleId": 8

  },

  "excludedItemsCount": 1,

  "usn": 22,

  "_links":    {

     "self": {"href": "https://abc.ukwest.cloudapp.azure.com/api/v1/policies/339740af-7075-418c-9638-bc5cc9dfd9ef"},

     "selecteditems": {"href": "https://abc.ukwest.cloudapp.azure.com/api/v1/policies/339740af-7075-418c-9638-bc5cc9dfd9ef/selectedItems"},

     "excludeditems": {"href": "https://abc.ukwest.cloudapp.azure.com/api/v1/policies/339740af-7075-418c-9638-bc5cc9dfd9ef/excludedItems"},

     "targetrepository": {"href": "https://abc.ukwest.cloudapp.azure.com/api/v1/repositories/1"}

  },

  "name": "Backup Policy via REST",

  "description": "",

  "tenantId": "3e924ba9-93bc-40d5-8a47-33f07b239a52",

  "retrySettings": {"retryCount": 3},

  "policyNotificationSettings":    {

     "recipient": "@tech.local",

     "notifyOnSuccess": true,

     "notifyOnWarning": true,

     "notifyOnFailure": true

  },

  "isEnabled": true,

  "backupType": "SelectedItems"

}

I want to report a typo

There is a misspelling right here:

 

I want to let the Veeam Documentation Team know about that.