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
- 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
|
- Find the link for the /jobs resource collection:
<Link Rel="Down" Type="JobReferenceList" Href="https://localhost:9398/api/jobs" /> |
- 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"> |
- 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" /> |
- 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"> |
- 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"> |
- 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"> |
Result
The job is started.