XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Backup job list with most recent status

    Scheduled Pinned Locked Moved REST API
    1 Posts 1 Posters 138 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B Offline
      billcouper
      last edited by billcouper

      I am trying to use the API to produce a list of backup jobs and their most recent status (success/fail/warn/etc).

      ====================

      So far, I am going to this API node

      https://xo.fqdn/rest/v0/backup/jobs/vm
      

      Then following all those references to find the name of each job

      https://xo.fqdn/rest/v0/backup/jobs/vm/510be304-3777-4765-825d-5f1d78e98bb0
      

      Then getting the backup job logs

      https://xo.fqdn/rest/v0/backups/logs
      

      Then following all those references to find the logs where the id matches the list of jobs I know about

      https://xo.fqdn/rest/v0/backup/logs/1717495512575
      

      And from that output pulling the status value and compiling it all together

      ====================

      What I really need is something like the output of this query

      https://xo.fqdn/rest/v0/backup/logs?fields=id,status,jobName&limit=11
      

      But the problem with this query is that I have to limit the result to the number of jobs and it only works if each job runs once a day etc etc. Right now, I have 11 jobs and they all only run once a day, so I believe that the query will work for me (assuming the most recent log entries are at the start of the list)... but as soon as I add or remove a job, or a job runs more than once a day, it breaks.

      @julien-f Is there a more elegant method to retrieve ALL backup jobs and their last 'status' value? I'd like to do this in a single, fast, efficient query if it's possible

      1 Reply Last reply Reply Quote 0
      • First post
        Last post