Web API and XML Hell

This topic contains 2 replies, has 2 voices, and was last updated by  Tom 4 weeks ago.

  • Author
  • #102920


    OK having Issues with a Veeam Backup Solution API, basically, I was to pull the Job Name, Last Job Time, and status.
    I can connect and collect a list of backups, not ordered 🙁 I get a list of these:


    I can filter the XML and order its etc... but that's where I get stuck, my current PowerShell is:

    $Date = get-date
    $DateStr = $Date.ToString("yyyy-MM")
    $response = Invoke-WebRequest -Uri $uri -Method "GET" -Headers @{"X-RestSvcSessionId" = $sessionId}
    $Test_Servers =  ([xml]$response.Content).EntityReferences.Ref| where {$_ -like "Test_Servers@"+$DateStr+"*"}| Sort-Object –Descending| Select-Object -first 1

    This outputs the full Test_Server@lastdate-of-this-month, So now I need to get not only the name/date but the link (/api/backupSessions/f0310a71-60bb-46cf-bc0d-02d8fa7729f3?format=Entity) as when i go here it gives me the Success

    Hopes this makes sense as I'm going round the bend after 6 hours of pulling my hair out, thanks

  • #102922

    Don Jones

    You can't post XML in the forums. You'll need to use a Gist.

  • #102925


    I cannot find my post to edit it? im defo going round the bend

You must be logged in to reply to this topic.