This is an archive version of the document. To get the most up-to-date information, see the
current version.
Step 2. Perform Logon
Before you can start working with Veeam Backup Enterprise Manager RESTful API resources, you must log on to Veeam Backup Enterprise Manager and create a new logon session.
- When you access the Veeam Backup Enterprise Manager RESTful API by its base URL, Veeam Backup Enterprise Manager returns a representation with a link to a list of existing sessions and links to creating a new logon session. The SupportedVersion sections in the representation indicate versions of Veeam Backup Enterprise Manager RESTful API. You can create a new logon session to work with resources that are supported in the latest or the specified version of RESTful API.
To work with all Veeam Backup Enterprise Manager RESTful API resources available in the current version of Veeam Backup & Replication and to access a complete set of actions that can be performed with those resources, create a new logon session using the link to the latest version of the /sessionMngr/ resource. For example, to work with RESTful API resources supported in Veeam Backup & Replication 9.0, create a new logon session using one of the following links:
- http://localhost:9399/api/sessionMngr/?v=latest
- http://localhost:9399/api/sessionMngr/?v=v1_2
If Veeam Backup & Replication 8.0 Update <Update_Version> is installed on your Veeam backup server, you should create a new logon session using the link to the previous version of Veeam Backup Enterprise Manager RESTful API: http://localhost:9399/api/sessionMngr/?v=v1_1.
Request: GET http://localhost:9399/api/ Response: 200 Success Response Body: <EnterpriseManager xmlns="http://www.veeam.com/ent/v1.0"> <Links> <Link Rel="Down" Type="LogonSessionList" Href="http://localhost:9399/api/logonSessions" /> <Link Rel="Create" Type="LogonSession" Href="http://localhost:9399/api/sessionMngr/?v=latest" /> </Links> <SupportedVersions> <SupportedVersion Name="v1"> <Links> <Link Rel="Create" Type="LogonSession" Href="http://localhost:9399/api/sessionMngr/?v=v1" /> </Links> </SupportedVersion> <SupportedVersion Name="v1_1"> <Links> <Link Rel="Create" Type="LogonSession" Href="http://localhost:9399/api/sessionMngr/?v=v1_1" /> </Links> </SupportedVersion> <SupportedVersion Name="v1_2"> <Links> <Link Rel="Create" Type="LogonSession" Href="http://localhost:9399/api/sessionMngr/?v=v1_2" /> </Links> </SupportedVersion> </SupportedVersions> </EnterpriseManager> |
- As there are no existing logon session, you need to create a new one. A new logon session is created by sending the POST HTTP request to the /sessionMngr/ resource. In the header of the request, provide user credentials of the account you plan to use for the current logon session. To make up the credentials string:
- Construct a string in the username:password format.
- Encode the string with base64 encoding.
- Add the Authorization header to the POST HTTP request. In the value of the header, specify Basic <encoded_string>:
Authorization: Basic QWRtaW5pc3RyYXRvcjpUcmVzc3Bhc3Mx |
- Send the composed POST HTTP request to the /sessionMngr/ resource. Veeam Backup Enterprise Manager will return a list of resources with which you can work using Veeam Backup Enterprise Manager RESTful API. In the UserName element, Veeam Backup Enterprise Manager will return a name of the user who is currently logged on. In the header of the response, Veeam Backup Enterprise Manager will supply a newly generated authorization token for the created logon session:
Request: POST http://localhost:9399/api/sessionMngr/?v=v1_2 Request Header: Authorization: Basic QWRtaW5pc3RyYXRvcjpUcmVzc3Bhc3Mx Response: 201 Created Response Header: X-RestSvcSessionId: O9Msj3rq7EGUhtSMBQx+mw== Response Body: <LogonSession xmlns="http://www.veeam.com/ent/v1.0" Type="LogonSession" Href="http://localhost:9399/api/logonSessions/4f04e5e7-629e-41b0-8629-61740bd6eedb"> <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" /> <Link Rel="Down" Type="BackupReferenceList" Href="http://localhost:9399/api/backups" /> <Link Rel="Down" Type="RestorePointReferenceList" Href="http://localhost:9399/api/restorePoints" /> <Link Rel="Down" Type="VmRestorePointReferenceList" Href="http://localhost:9399/api/vmRestorePoints" /> <Link Rel="Down" Type="VAppRestorePointReferenceList" Href="http://localhost:9399/api/vAppRestorePoints" /> <Link Rel="Down" Type="ReplicaReferenceList" Href="http://localhost:9399/api/replicas" /> <Link Rel="Down" Type="VmReplicaPointReferenceList" Href="http://localhost:9399/api/vmReplicaPoints" /> <Link Rel="Down" Type="CatalogVmReferenceList" Href="http://localhost:9399/api/catalog/vms" /> <Link Rel="Down" Type="BackupJobSessionReferenceList" Href="http://localhost:9399/api/backupSessions" /> <Link Rel="Down" Type="RestoreSessionReferenceList" Href="http://localhost:9399/api/restoreSessions" /> <Link Rel="Down" Type="ReplicaJobSessionReferenceList" Href="http://localhost:9399/api/replicaSessions" /> <Link Rel="Down" Type="BackupTaskSessionReferenceList" Href="http://localhost:9399/api/backupTaskSessions" /> <Link Rel="Down" Type="ReplicaTaskSessionReferenceList" Href="http://localhost:9399/api/replicaTaskSessions" /> <Link Rel="Down" Type="EnterpriseSecuritySettings" Href="http://localhost:9399/api/security" /> <Link Rel="Down" Type="WanAcceleratorReferenceList" Href="http://localhost:9399/api/wanAccelerators" /> <Link Rel="Down" Type="TaskList" Href="http://localhost:9399/api/tasks" /> <Link Rel="Down" Type="QueryService" Href="http://localhost:9399/api/querySvc" /> <Link Rel="Down" Type="LookupService" Href="http://localhost:9399/api/lookupSvc" /> <Link Rel="Down" Type="Report" Href="http://localhost:9399/api/reports/summary" Name="Summary" /> <Link Rel="Down" Type="BackupServerList" Href="http://localhost:9399/api/backupServers?format=Entity" /> <Link Rel="Down" Type="ManagedServerList" Href="http://localhost:9399/api/managedServers?format=Entity" /> <Link Rel="Create" Href="http://localhost:9399/api/backupServers?action=create" /> <Link Rel="Down" Type="JobList" Href="http://localhost:9399/api/jobs?format=Entity" /> <Link Rel="Down" Type="FailoverPlanList" Href="http://localhost:9399/api/failoverPlans?format=Entity" /> <Link Rel="Down" Type="HierarchyRootList" Href="http://localhost:9399/api/hierarchyRoots?format=Entity" /> <Link Rel="Down" Type="RepositoryList" Href="http://localhost:9399/api/repositories?format=Entity" /> <Link Rel="Down" Type="BackupList" Href="http://localhost:9399/api/backups?format=Entity" /> <Link Rel="Down" Type="RestorePointList" Href="http://localhost:9399/api/restorePoints?format=Entity" /> <Link Rel="Down" Type="VmRestorePointList" Href="http://localhost:9399/api/vmRestorePoints?format=Entity" /> <Link Rel="Down" Type="VAppRestorePointList" Href="http://localhost:9399/api/vAppRestorePoints?format=Entity" /> <Link Rel="Down" Type="ReplicaList" Href="http://localhost:9399/api/replicas?format=Entity" /> <Link Rel="Down" Type="VmReplicaPointList" Href="http://localhost:9399/api/vmReplicaPoints?format=Entity" /> <Link Rel="Down" Type="CatalogVmList" Href="http://localhost:9399/api/catalog/vms?format=Entity" /> <Link Rel="Down" Type="BackupJobSessionList" Href="http://localhost:9399/api/backupSessions?format=Entity" /> <Link Rel="Down" Type="RestoreSessionList" Href="http://localhost:9399/api/restoreSessions?format=Entity" /> <Link Rel="Down" Type="ReplicaJobSessionList" Href="http://localhost:9399/api/replicaSessions?format=Entity" /> <Link Rel="Down" Type="BackupTaskSessionList" Href="http://localhost:9399/api/backupTaskSessions?format=Entity" /> <Link Rel="Down" Type="ReplicaTaskSessionList" Href="http://localhost:9399/api/replicaTaskSessions?format=Entity" /> <Link Rel="Down" Type="WanAcceleratorList" Href="http://localhost:9399/api/wanAccelerators?format=Entity" /> <Link Rel="Down" Type="CloudConnectService" Href="http://localhost:9399/api/cloud" /> <Link Rel="Delete" Type="LogonSession" Href="http://localhost:9399/api/logonSessions/4f04e5e7-629e-41b0-8629-61740bd6eedb" /> </Links> <UserName>SRV36\Administrator</UserName> <SessionId>4f04e5e7-629e-41b0-8629-61740bd6eedb</SessionId> </LogonSession> |
- You must copy the obtained X-RestSvcSessionId header and send it in the header of all subsequent requests to Veeam Backup Enterprise Manager.
Note: |
To create a new logon session for a tenant, you need to provide tenant credentials in the body of the POST HTTP request to the URL of the /sessionMngr/ resource. To learn more, see Tenant Logon Session. |