Help Center
Choose product document...
Veeam Backup & Replication 9.5
RESTful API Reference

Starting a Job

Using Veeam Backup Enterprise Manager RESTful API, you can start a job created on the Veeam backup server connected to Veeam Backup Enterprise Manager.

Prerequisites

Make sure you are logged on to Veeam Backup Enterprise Manager under the user account to which the Portal Administrator role is assigned. If you use an account to which the Portal User or Restore Operator role is assigned, you will not be able to start a job.

Procedure

  1. After you access Veeam Backup Enterprise Manager RESTful API and create a new logon session, examine the representation of the logon session that the server has returned:

Request:

POST http://localhost:9399/api/sessionMngr/?v=v1_2

 

Request Header:

Authorization: Basic QWRtaW5pc3RyYXRvcjpUcmVzc3Bhc3Mx

 

Response:

201 Created

 

Response Header:

X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj


Response Body:

<LogonSession xmlns="http://www.veeam.com/ent/v1.0" Type="LogonSession" Href="http://localhost:9399/api/logonSessions/25df603f-1d53-4c3f-9c09- f94455ed7258<">
 <Links>
   <Link Rel="Up" Type="EnterpriseManager" Href="http://localhost:9399/api/" />
   <Link Rel="Down" Type="BackupServerReferenceList" Href="http://localhost:9399/api/backupServers" />
   <Link Rel="Down" Type="ManagedServerReferenceList" Href="http://localhost:9399/api/managedServers" />
   <Link Rel="Down" Type="JobReferenceList" Href="http://localhost:9399/api/jobs" />
   <Link Rel="Down" Type="FailoverPlanReferenceList" Href="http://localhost:9399/api/failoverPlans" />
   <Link Rel="Down" Type="HierarchyRootReferenceList" Href="http://localhost:9399/api/hierarchyRoots" />
   <Link Rel="Down" Type="RepositoryReferenceList" Href="http://localhost:9399/api/repositories" />
   ...
 </Links>
 <UserName>SRV02\Administrator</UserName>
 <SessionId>25df603f-1d53-4c3f-9c09- f94455ed7258<</SessionId>
</LogonSession>

  1. Find the link for the /jobs resource collection:

<Link Rel="Down" Type="JobReferenceList" Href="http://localhost:9399/api/jobs" />

  1. From the link, retrieve the URL for the /jobs collection. The URL is specified in the Href element. Send the GET HTTP request to the retrieved URL. The server will return a representation of all jobs that are created on Veeam backup servers connected to Veeam Backup Enterprise Manager:

Request:

GET http://localhost:9399/api/jobs

 

Request Header:

X-RestSvcSessionId:   NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj

 

Response:

200 Success

 

Response Body:

<EntityReferences xmlns="http://www.veeam.com/ent/v1.0">
 <Ref Type="JobReference" Href="http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac" Name="SQL Replication" UID="urn:veeam:Job:b04c217b-0538-4650-bec4-19deff4ea1ac">
   <Links>
     <Link Rel="Up" Type="BackupServerReference" Href="http://localhost:9399/api/backupServers/ce15a8c7-aa49-495e-b05b-ee3398c91018" Name="srv02.veeam.local" />
     <Link Rel="Alternate" Type="Job" Href="http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac?format=Entity" Name="SQL Replication" />
     <Link Rel="Down" Type="ReplicaJobSessionReferenceList" Href="http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac/replicaSessions" />
   </Links>
 </Ref>
 <Ref Type="JobReference" Href="http://localhost:9399/api/jobs/065c3eed-175d-4fd8-89c8-2da82b0dcd4f" Name="SQL Server Replication" UID="urn:veeam:Job:065c3eed-175d-4fd8-89c8-2da82b0dcd4f">
   <Links>
     <Link Rel="Up" Type="BackupServerReference" Href="http://localhost:9399/api/backupServers/ce15a8c7-aa49-495e-b05b-ee3398c91018" Name="srv02.veeam.local" />
     <Link Rel="Alternate" Type="Job" Href="http://localhost:9399/api/jobs/065c3eed-175d-4fd8-89c8-2da82b0dcd4f?format=Entity" Name="SQL Server Replication" />
     <Link Rel="Down" Type="ReplicaJobSessionReferenceList" Href="http://localhost:9399/api/jobs/065c3eed-175d-4fd8-89c8-2da82b0dcd4f/replicaSessions" />
   </Links>
 </Ref>
...
</EntityReferences>

  1. Examine the received resource representation and find a link to the entity of the necessary job. The Rel attribute in the link will be set to Alternate:

<Link Rel="Alternate" Type="Job" Href="http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac?format=Entity" Name="SQL Replication" />

  1. Retrieve the URL for the job entity and send the GET HTTP request to the retrieved URL. The server will return a resource representation of the job:

Request:

GET http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac?format=Entity

 

Request Header:

X-RestSvcSessionId:   NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj

 

Response:

200 Success

 

Response Body:

<Job xmlns="http://www.veeam.com/ent/v1.0" Type="Job" Href="http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac?format=Entity" Name="SQL Replication" UID="urn:veeam:Job:b04c217b-0538-4650-bec4-19deff4ea1ac">
 <Links>
   <Link Rel="Up" Type="BackupServerReference" Href="http://localhost:9399/api/backupServers/ce15a8c7-aa49-495e-b05b-ee3398c91018" Name="srv02.veeam.local" />
   <Link Rel="Alternate" Type="JobReference" Href="http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac" Name="SQL Replication" />
   <Link Rel="Down" Type="ReplicaJobSessionReferenceList" Href="http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac/replicaSessions" />
   <Link Rel="Down" Type="ObjectInJobList" Href="http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac/includes" />
   <Link Rel="Edit" Type="JobReference" Href="http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac" Name="SQL Replication" />
   <Link Rel="Create" Type="ObjectInJob" Href="http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac/includes" />
   <Link Rel="Start" Href="http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac?action=start" />
   <Link Rel="Stop" Href="http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac?action=stop" />
   <Link Rel="Retry" Href="http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac?action=retry" />
   <Link Rel="Clone" Href="http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac?action=clone" />
   <Link Rel="ToggleScheduleEnabled" Href="http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac?action=toggleScheduleEnabled" />
 </Links>
 <JobType>Replica</JobType>
 <Platform>VMware</Platform>
 <Description>Created by SRV02\Administrator at 10/7/2014 6:02 AM.</Description>
 <ScheduleConfigured>false</ScheduleConfigured>
 <ScheduleEnabled>true</ScheduleEnabled>
 <JobScheduleOptions>
   <RetryOptions>
     <RetryTimes>3</RetryTimes>
     <RetryTimeout>10</RetryTimeout>
     <RetrySpecified>true</RetrySpecified>
   </RetryOptions>
   <WaitForBackupCompletion>true</WaitForBackupCompletion>
   <BackupCompetitionWaitingPeriodMin>180</BackupCompetitionWaitingPeriodMin>
   <OptionsDaily Enabled="true">
     <Kind>Everyday</Kind>
     <Days>Sunday</Days>
     <Days>Monday</Days>
     <Days>Tuesday</Days>
     <Days>Wednesday</Days>
     <Days>Thursday</Days>
     <Days>Friday</Days>
     <Days>Saturday</Days>
     <Time>22:00:00.0000000-07:00</Time>
   </OptionsDaily>
   <OptionsMonthly Enabled="false">
     <Time>22:00:00.0000000-07:00</Time>
     <DayNumberInMonth>Fourth</DayNumberInMonth>
     <DayOfWeek>Saturday</DayOfWeek>
     <Months>January</Months>
     <Months>February</Months>
     <Months>March</Months>
     <Months>April</Months>
     <Months>May</Months>
     <Months>June</Months>
     <Months>July</Months>
     <Months>August</Months>
     <Months>September</Months>
     <Months>October</Months>
     <Months>November</Months>
     <Months>December</Months>
   </OptionsMonthly>
   <OptionsPeriodically Enabled="false">
     <Kind>Hours</Kind>
     <FullPeriod>1</FullPeriod>
     <Schedule>
       <Day Name="Sunday">1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1</Day>
       <Day Name="Monday">1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1</Day>
       <Day Name="Tuesday">1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1</Day>
       <Day Name="Wednesday">1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1</Day>
       <Day Name="Thursday">1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1</Day>
       <Day Name="Friday">1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1</Day>
       <Day Name="Saturday">1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1</Day>
     </Schedule>
   </OptionsPeriodically>
   <OptionsContinuous Enabled="false" />
   <OptionsBackupWindow Enabled="false">
     <TimePeriods>
       <Day Name="Sunday">1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1</Day>
       <Day Name="Monday">1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1</Day>
       <Day Name="Tuesday">1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1</Day>
       <Day Name="Wednesday">1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1</Day>
       <Day Name="Thursday">1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1</Day>
       <Day Name="Friday">1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1</Day>
       <Day Name="Saturday">1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1</Day>
     </TimePeriods>
   </OptionsBackupWindow>
   <OptionsDaisyChaining Enabled="false">
     <PreviousJobUid />
   </OptionsDaisyChaining>
 </JobScheduleOptions>
 <JobInfo>
   <ReplicaJobInfo>
     <Includes>
       <ObjectInJob Type="ObjectInJob" Href="http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac/includes/d8f628b7-6fe4-498b-bfca-01a167b2124c">
         <ObjectInJobId>d8f628b7-6fe4-498b-bfca-01a167b2124c</ObjectInJobId>
         <HierarchyObjRef>urn:VMware:Vm:ca2f751f-8f26-4f39-815e-ce493b61fd80.11</HierarchyObjRef>
         <Name>sql02</Name>
         <DisplayName>sql02</DisplayName>
         <Order>0</Order>
         <GuestProcessingOptions>
           <VssSnapshotOptions>
             <VssSnapshotMode>RequireSuccess</VssSnapshotMode>
             <IsCopyOnly>true</IsCopyOnly>
           </VssSnapshotOptions>
           <WindowsGuestFSIndexingOptions>
             <FileSystemIndexingMode>ExceptSpecifiedFolders</FileSystemIndexingMode>
             <IncludedIndexingFolders />
             <ExcludedIndexingFolders>
               <Path>%windir%</Path>
               <Path>%ProgramFiles%</Path>
               <Path>%ProgramFiles(x86)%</Path>
               <Path>%ProgramW6432%</Path>
               <Path>%TEMP%</Path>
             </ExcludedIndexingFolders>
           </WindowsGuestFSIndexingOptions>
           <LinuxGuestFSIndexingOptions>
             <FileSystemIndexingMode>ExceptSpecifiedFolders</FileSystemIndexingMode>
             <IncludedIndexingFolders />
             <ExcludedIndexingFolders>
               <Path>/cdrom</Path>
               <Path>/dev</Path>
               <Path>/media</Path>
               <Path>/mnt</Path>
               <Path>/proc</Path>
               <Path>/tmp</Path>
               <Path>/lost+found</Path>
             </ExcludedIndexingFolders>
           </LinuxGuestFSIndexingOptions>
           <SqlBackupOptions>
             <TransactionLogsProcessing>Never</TransactionLogsProcessing>
             <BackupLogsFrequencyMin>15</BackupLogsFrequencyMin>
             <UseDbBackupRetention>true</UseDbBackupRetention>
             <RetainDays>15</RetainDays>
           </SqlBackupOptions>
           <WindowsCredentialsId>00000000-0000-0000-0000-000000000000</WindowsCredentialsId>
           <LinuxCredentialsId>00000000-0000-0000-0000-000000000000</LinuxCredentialsId>
         </GuestProcessingOptions>
       </ObjectInJob>
     </Includes>
     <GuestProcessingOptions>
       <VssSnapshotOptions>
         <VssSnapshotMode>Disabled</VssSnapshotMode>
         <IsCopyOnly>true</IsCopyOnly>
       </VssSnapshotOptions>
       <WindowsGuestFSIndexingOptions>
         <FileSystemIndexingMode>Disabled</FileSystemIndexingMode>
         <IncludedIndexingFolders />
         <ExcludedIndexingFolders />
       </WindowsGuestFSIndexingOptions>
       <LinuxGuestFSIndexingOptions>
         <FileSystemIndexingMode>Disabled</FileSystemIndexingMode>
         <IncludedIndexingFolders />
         <ExcludedIndexingFolders />
       </LinuxGuestFSIndexingOptions>
       <SqlBackupOptions>
         <TransactionLogsProcessing>Never</TransactionLogsProcessing>
         <BackupLogsFrequencyMin>15</BackupLogsFrequencyMin>
         <UseDbBackupRetention>true</UseDbBackupRetention>
         <RetainDays>15</RetainDays>
       </SqlBackupOptions>
       <WindowsCredentialsId>00000000-0000-0000-0000-000000000000</WindowsCredentialsId>
       <LinuxCredentialsId>00000000-0000-0000-0000-000000000000</LinuxCredentialsId>
     </GuestProcessingOptions>
   </ReplicaJobInfo>
 </JobInfo>
</Job>

  1. Find a link to the job start action and send the POST HTTP request to the job start action URL. The job is started asynchronously: Veeam Backup Enterprise Manager creates a new task for the job start and returns the HTTP/1.1 202 ACCEPTED status to the client. In the response body, Veeam Backup Enterprise Manager returns a resource representation of the task.

Request:

POST http://localhost:9399/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac?action=start/

 

Request Header:

X-RestSvcSessionId:   NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj

 

Response:

202 Created

 

Response Body:

<Task xmlns="http://www.veeam.com/ent/v1.0" Type="Task" Href="http://localhost:9399/api/tasks/task-1">
 <Links>
   <Link Rel="Delete" Type="Task" Href="http://localhost:9399/api/tasks/task-1" />
 </Links>
 <TaskId>task-1</TaskId>
 <State>Running</State>
 <Operation>StartJob</Operation>
</Task>

  1. Every task has its own ID. In the given example, the task ID is task-1. To trace the task performance and check the task result, send the GET HTTP request to the task resource. The server will return a resource representation of the task describing the task status and result:

Request:

GET http://localhost:9399/api/tasks/task-1

 

Request Header:

X-RestSvcSessionId:   NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj

 

Response:

200 Success

 

Response Body:

<Task xmlns="http://www.veeam.com/ent/v1.0" Type="Task" Href="http://localhost:9399/api/tasks/task-1">
 <Links>
   <Link Rel="Delete" Type="Task" Href="http://localhost:9399/api/tasks/task-1" />
 </Links>
 <TaskId>task-1</TaskId>
 <State>Finished</State>
 <Operation>StartJob</Operation>
 <Result Success="true">
   <Message>Ok</Message>
 </Result>
</Task>

Result

The job is started.

Veeam Large Logo

User Guide for VMware vSphere

User Guide for Microsoft Hyper-V

Enterprise Manager User Guide

Veeam Cloud Connect Guide

Veeam Backup Explorers User Guide

PowerShell Reference

RESTful API Reference

Veeam Backup FREE Edition User Guide

Veeam Backup for Microsoft Office 365

Veeam ONE Documentation

Veeam Endpoint Backup Documentation

Veeam Management Pack Documentation