Hi,
Admittedly, I am painting with a very broad brush.
The goal is to connect to Veeam’s REST APIs to grab data, and ship it to a monitoring system for further parsing and processing.
I need an education on how to do this using PowerShell. I have read Invoke-WebRequest and Invoke-RestMethod; those are tools, but not the education.
Notion #1 , how do I connect (formulate the one liner), and provide enough credentials, as to authenticate to the API?
I have a local user on the server, and a foggy notion that passing those credentials will return a token.
Notion #2 , once I have the ability to connect, how do I construct the requests to get data from the API?
I’m looking less for soemone on the forum to do this for me, more that if there is eductation on how to use PowerShell to do this, that I can read it.
Cheers and thank you,
Seth
If it helps, the API can be access via Swagger, and relevant information is:
Request URL
https://:FQDN:1239/api/token
curl -X ‘POST’
‘https://:FQDN:1239/api/token’
-H ‘accept: application/json’
-H ‘Content-Type: application/x-www-form-urlencoded’
-d ‘username=USERNAME&password=PASSWORD&grant_type=password&refresh_token=string’
Return is
"access_token": token string
"refresh_token": token string
"token_type": "Bearer",
"expires_in": 899,
"user": "user\pass",
"user_role": "ReadonlyUser"
Very broad brush. What API? If you’re talking about veeam backup and recovery, they have a powershell module that is already present on each VBR server. If you’re talking about the veeam cloud service provider or the veeam website, those are different things altogether. Kindly clarify what api you are actually trying to communicate and also what data you are trying to retrieve.
This is where AI comes in handy. You know the CURL command for what you’re doing. I just asked AI to translate that to PowerShell:
$headers = @{
"accept" = "application/json"
"Content-Type" = "application/x-www-form-urlencoded"
}
$body = @{
username = "USERNAME"
password = "PASSWORD"
grant_type = "password"
refresh_token = "string"
}
$response = Invoke-RestMethod -Uri "https://:FQDN:1239/api/token" -Method Post -Headers $headers -Body $body
$response
From there, API calls would look something like this:
$token = $response.access_token
$headers = @{
"Authorization" = "Bearer $token"
"accept" = "application/json"
}
$response2 = Invoke-RestMethod -Uri "APIURL" -Method Get -Headers $headers
$response2
That’s really generic, but should give you a starting point.
Hi, krzydoug,
VBR indeed has a PowerShell module, but VeeamONE, the reporting server, does not. It uses REST API.
Because our implementation will have multiple VBR servers, there may be sense to get data from VeeamONE via the API, as opposed to connecting to individual VBR servers. Kinda don’t know until I get to that bridge.
Data will be classic backup job name, last run date and job status. This will be fed to Nagios, for alerting and notifications.
Hi, psdarwin,
I’m not against AI, but I ain’t for it, either. If machine learning can replicate my dad-sarcasm, then what value am I?
Thank you for the hints. Every little bit teaches me something new.
I found this link, which has all the magic I need, to get me further down the road. Credit where credit is due.
Though my Veeam version is 12, not 11 as is Mark Tellier’s version 11, this worked exactly.
Demonstrate how to use PowerShell to access the new RESTFul API in Veeam ONE 11
2 Likes
system
Closed
September 11, 2025, 8:07pm
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.