Web API and XML Hell

Welcome Forums Pester Web API and XML Hell

Viewing 2 reply threads
  • Author
    Posts
    • #102920
      Tom
      Participant
      Topics: 3
      Replies: 5
      Points: 32
      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 "[email protected]"+$DateStr+"*"}| Sort-Object –Descending| Select-Object -first 1
      

      This outputs the full [email protected], 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
      Topics: 18
      Replies: 4872
      Points: 1,903
      Helping HandTeam Member
      Rank: Community Hero

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

    • #102925
      Tom
      Participant
      Topics: 3
      Replies: 5
      Points: 32
      Rank: Member

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

Viewing 2 reply threads
  • The topic ‘Web API and XML Hell’ is closed to new replies.