Web API and XML Hell

Welcome Forums Pester Web API and XML Hell

This topic contains 2 replies, has 2 voices, and was last updated by

Tom
 
Participant
4 months ago.

  • Author
    Posts
  • #102920
    Tom

    Participant
    Points: 0
    Rank: Member

    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
    Tom

  • #102922

    Keymaster
    Points: 1
    Rank: Member

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

  • #102925
    Tom

    Participant
    Points: 0
    Rank: Member

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

The topic ‘Web API and XML Hell’ is closed to new replies.