Starting Job

Using Veeam Backup Enterprise Manager REST API, you can start a job created on the 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 REST API and create a new logon session, examine the representation of the logon session that the server has returned:

Request:

POST https://localhost:9398/api/sessionMngr/?v=v1_7

 

Request Header:

Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

 

Response:

201 Created

 

Response Header:

X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj


Response Body:

<LogonSession xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.veeam.com/ent/v1.0" Href="https://enterprise04.tech.local:9398/api/logonSessions/7686d89e-26fd-48e6-963c-c9dbce802981" Type="LogonSession">
 <Links>
   <Link Href="https://enterprise04.tech.local:9398/api/" Type="EnterpriseManager" Rel="Up"/>
   <Link Href="https://enterprise04.tech.local:9398/api/backupServers" Type="BackupServerReferenceList" Rel="Down"/>
   <Link Href="https://enterprise04.tech.local:9398/api/managedServers" Type="ManagedServerReferenceList" Rel="Down"/>
   <Link Href="https://enterprise04.tech.local:9398/api/jobs" Type="JobReferenceList" Rel="Down"/>
    …
 </Links>
 <UserName>TECH\sheila.d.cory</UserName>
 <SessionId>7686d89e-26fd-48e6-963c-c9dbce802981</SessionId>
</LogonSession>

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

<Link Rel="Down" Type="JobReferenceList" Href="https://localhost:9398/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 backup servers connected to Veeam Backup Enterprise Manager:

Request:

GET https://localhost:9398/api/jobs

 

Request Header:

X-RestSvcSessionId:   NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj

 

Response:

200 OK

 

Response Body:

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

<Link Rel="Alternate" Type="Job" Href="https://localhost:9398/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 https://localhost:9398/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac?format=Entity

 

Request Header:

X-RestSvcSessionId:   NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj

 

Response:

200 OK

 

Response Body:

<Job xmlns="http://www.veeam.com/ent/v1.0" Type="Job" Href="https://localhost:9398/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="https://localhost:9398/api/backupServers/ce15a8c7-aa49-495e-b05b-ee3398c91018" Name="srv02.tech.local" />
   <Link Rel="Alternate" Type="JobReference" Href="https://localhost:9398/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac" Name="SQL Replication" />
   <Link Rel="Down" Type="ReplicaJobSessionReferenceList" Href="https://localhost:9398/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac/replicaSessions" />
   <Link Rel="Down" Type="ObjectInJobList" Href="https://localhost:9398/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac/includes" />
   <Link Rel="Edit" Type="JobReference" Href="https://localhost:9398/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac" Name="SQL Replication" />
   <Link Rel="Create" Type="ObjectInJob" Href="https://localhost:9398/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac/includes" />
   <Link Rel="Start" Href="https://localhost:9398/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac?action=start" />
   <Link Rel="Stop" Href="https://localhost:9398/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac?action=stop" />
   <Link Rel="Retry" Href="https://localhost:9398/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac?action=retry" />
   <Link Rel="Clone" Href="https://localhost:9398/api/jobs/b04c217b-0538-4650-bec4-19deff4ea1ac?action=clone" />
   <Link Rel="ToggleScheduleEnabled" Href="https://localhost:9398/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="https://localhost:9398/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>
         <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 https://localhost:9398/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="https://localhost:9398/api/tasks/task-1">
 <Links>
   <Link Rel="Delete" Type="Task" Href="https://localhost:9398/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 track 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 https://localhost:9398/api/tasks/task-1

 

Request Header:

X-RestSvcSessionId:   NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj

 

Response:

200 OK

 

Response Body:

<Task xmlns="http://www.veeam.com/ent/v1.0" Type="Task" Href="https://localhost:9398/api/tasks/task-1">
 <Links>
   <Link Rel="Delete" Type="Task" Href="https://localhost:9398/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.

Page updated 9/1/2023

Page content applies to build 12.2.0.334