-
- Enthusiast
- Posts: 28
- Liked: 1 time
- Joined: Jul 24, 2019 10:04 am
- Contact:
API Query for AgentRestorePoints
Hi there,
Just wondering if there's any way to query the API for either generic restore points or specifically AgentRestorePoints in the same way you can with VmRestorePoints. I just observed that in my reports, Agents are not being found.
This works perfectly for my regular VM backups:
$response = Invoke-WebRequest -Uri "http://xxx:9399/api/query?type=VmRestor ... eationTime" -Method "GET" -Headers @{"X-RestSvcSessionId" = $sessionId }
But if I use AgentRestorePoint, it errors on the filter of VmName and it doesn't recognize AgentName as a valid filter criteria either. The documentation is unclear on what attributes are available for any given object for filtering purposes (although that may just be me missing something)
Just wondering if there's any way to query the API for either generic restore points or specifically AgentRestorePoints in the same way you can with VmRestorePoints. I just observed that in my reports, Agents are not being found.
This works perfectly for my regular VM backups:
$response = Invoke-WebRequest -Uri "http://xxx:9399/api/query?type=VmRestor ... eationTime" -Method "GET" -Headers @{"X-RestSvcSessionId" = $sessionId }
But if I use AgentRestorePoint, it errors on the filter of VmName and it doesn't recognize AgentName as a valid filter criteria either. The documentation is unclear on what attributes are available for any given object for filtering purposes (although that may just be me missing something)
-
- Enthusiast
- Posts: 28
- Liked: 1 time
- Joined: Jul 24, 2019 10:04 am
- Contact:
Re: API Query for AgentRestorePoints
Whoops - for readability, here's the extracted request string:
api/query?type=VmRestorePoint&filter=VmName==$server&format=entities&sortDesc=CreationTime
api/query?type=VmRestorePoint&filter=VmName==$server&format=entities&sortDesc=CreationTime
-
- VP, Product Management
- Posts: 27377
- Liked: 2800 times
- Joined: Mar 30, 2009 9:13 am
- Full Name: Vitaliy Safarov
- Contact:
Re: API Query for AgentRestorePoints
I believe this is not available due to these reasons > Agent Jobs Via API
-
- Enthusiast
- Posts: 28
- Liked: 1 time
- Joined: Jul 24, 2019 10:04 am
- Contact:
Re: API Query for AgentRestorePoints
I think that may have been changed in an update since that discussion since I *can* extract AgentRestorePoints en masse via the API and according to the documentation (https://helpcenter.veeam.com/docs/backu ... l?ver=95u4) AgentRestorePoints are listed in the Query API as being valid resources to request via this API. There's now an endpoint at api/agents/jobs.
But there's absolutely nothing in the documentation concerning what attributes can be used for filtering for any of the ressources available via the Query interface. Even the VMName filter that I use for regular VM Backups was found by trawling through the forums.
But there's absolutely nothing in the documentation concerning what attributes can be used for filtering for any of the ressources available via the Query interface. Even the VMName filter that I use for regular VM Backups was found by trawling through the forums.
-
- Product Manager
- Posts: 20413
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: API Query for AgentRestorePoints
The following parameters are supported as querying filters for agent restore points:
Thanks!
Code: Select all
"Uid";
"Name";
"CreationTime";
"ComputerName";
"Type";
"Algorithm";
"RestorePointId";
"RestorePointName";
"BackupUid";
"BackupName";
"BackupServerUid";
"BackupServerName";
"BackupFileUid";
"BackupFileName";
-
- Enthusiast
- Posts: 28
- Liked: 1 time
- Joined: Jul 24, 2019 10:04 am
- Contact:
Re: API Query for AgentRestorePoints
Thanks ! That’s really useful information.
Any chance we could see updates to the documentation to include this information for each of the queryable objects?
Any chance we could see updates to the documentation to include this information for each of the queryable objects?
-
- Enthusiast
- Posts: 28
- Liked: 1 time
- Joined: Jul 24, 2019 10:04 am
- Contact:
Re: API Query for AgentRestorePoints
OK - now onto the next related problem. When I use the ComputerName for filtering, it works as long as the computer in question was registered via it's hostname, but if I have an agent registered using it's FQDN, I get this error when trying to search:
I've tried URI encoding the FQDN with %2E, but I'm still getting the same errors. Outside of going back and unregistering all of the agents and reregistering them using just the hostname, is there an encoding that the API will accept for querying agents by their full name?
Code: Select all
Invoke-WebRequest : <?xml version="1.0" encoding="utf-8"?><Error Message="Malformed expression string:
ComputerName==xxx.yyy.zzz.local" StatusCode="400" xmlns="http://www.veeam.com/ent/v1.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
At reporting_functions.ps1:432 char:17
+ ... $response = Invoke-WebRequest -Uri $uri -Method "GET" -Headers @{"X-R ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
-
- Veeam Software
- Posts: 149
- Liked: 47 times
- Joined: May 25, 2016 3:29 am
- Full Name: Ben Young
- Contact:
Re: API Query for AgentRestorePoints
If i recall, you can wrap the VmName in quotes, i.e
/api/query?type=VmRestorePoint&filter=VmName=="xxx.yyy.zzz.local"&format=entities&sortDesc=CreationTime
I dont have any servers with that type of hostname data but can replicate the malformed error, goes away if i wrap it in quotes (and returns the same result for servers i have without FQDN if quotes are there or not)
/api/query?type=VmRestorePoint&filter=VmName=="xxx.yyy.zzz.local"&format=entities&sortDesc=CreationTime
I dont have any servers with that type of hostname data but can replicate the malformed error, goes away if i wrap it in quotes (and returns the same result for servers i have without FQDN if quotes are there or not)
-
- Enthusiast
- Posts: 28
- Liked: 1 time
- Joined: Jul 24, 2019 10:04 am
- Contact:
Re: API Query for AgentRestorePoints
Good timing, I had just figured that trick with the quotes about 30 minutes before seeing your reply. Next step: trying to figure out why the syntax I use for extracting date from the most recent restorepoint that I use for VMRestorePoints doesn't seem to work on the AgentRestorePoints...
$lastbackup = ([datetime]([xml]$response.Content).QueryResult.Entities.AgentRestorePoints.AgentRestorePoint.CreationTimeUTC[0]).ToLocalTime()
vs
$lastbackup = ([datetime]([xml]$response.Content).QueryResult.Entities.VmRestorePoints.VmRestorePoint.CreationTimeUTC[0]).ToLocalTime()
But at least I'm getting data back from the API now.
Side note for dealing with the problem that my input list for servers to check comes as a hostname, my current workaround is to pull out all of the api/agents/discoveredComputers and build a hash out of the value keyed on the hostname part of the name with the value of whatever is used, whether it's an FQDN or a hostname.
$lastbackup = ([datetime]([xml]$response.Content).QueryResult.Entities.AgentRestorePoints.AgentRestorePoint.CreationTimeUTC[0]).ToLocalTime()
vs
$lastbackup = ([datetime]([xml]$response.Content).QueryResult.Entities.VmRestorePoints.VmRestorePoint.CreationTimeUTC[0]).ToLocalTime()
But at least I'm getting data back from the API now.
Side note for dealing with the problem that my input list for servers to check comes as a hostname, my current workaround is to pull out all of the api/agents/discoveredComputers and build a hash out of the value keyed on the hostname part of the name with the value of whatever is used, whether it's an FQDN or a hostname.
-
- Enthusiast
- Posts: 28
- Liked: 1 time
- Joined: Jul 24, 2019 10:04 am
- Contact:
Re: API Query for AgentRestorePoints
Huh - and now it works this morning. Go figure.
-
- Product Manager
- Posts: 20413
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
-
- Enthusiast
- Posts: 28
- Liked: 1 time
- Joined: Jul 24, 2019 10:04 am
- Contact:
Re: API Query for AgentRestorePoints
@veremin, Uhhh, the list you presented earlier in the thread does not match up with the list of attributes noted on the documentation page. The documentation page makes reference to VMDisplayName rather than ComputerName...
-
- Product Manager
- Posts: 20413
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: API Query for AgentRestorePoints
Got it, will correct the documentation soon (already notified tech writing team). Thanks!
Who is online
Users browsing this forum: No registered users and 3 guests