-
@julien-f Thanks, I did also try with
&
but it still returns every result (553 rows) so I wasn't sure. The exact query:http://xo.localdomain/rest/v0/backups/logs?fields=id,status,jobName&limit=10
Is it possible I have an older version of the REST API that doesn't support
filter
andlimit
?Also still unsure how to format the query to filter, I understand it uses XO syntax but how is that actually constructed? I think most of my issue is that I can't troubleshoot as it just returns every row regardless so I don't know what should work.
Are either of these correct? They both still return all 553 results.
http://xo.localdomain/rest/v0/backups/logs?fields=id,status&s=jobName%3A%22Pool%20Metadata%22
http://xo.localdomain/rest/v0/backups/logs?fields=id,status?s=jobName%3A%22Pool%20Metadata%22
-
- The parameter used for filtering is
filter
nots
, if you saw the last one in the documentation, it's an error, please let me know and I'll fix it - Filtering and limiting is not implemented for backup logs yet, I'll do it now.
- The parameter used for filtering is
-
@julien-f Thanks Julien.
I am just going based off of the REST API docs https://xen-orchestra.com/docs/restapi.html. These refer to https://xen-orchestra.com/docs/manage_infrastructure.html#live-filter-search which is what I've been basing it off as the API docs don't say what formatting to use, I assumed it was the same.
Edit: to be fair I think I probably just misunderstood, the REST docs do say
filter
but it linked to the syntax page which says uses
maybe mixed me up. Ideally if the docs could give quick examples of how to use the parameters that would be great, but obviously that's just a "nice to have" for the inexperienced people like me, not a demand. -
@olivierlambert It's very basic for now! I have just created a dash with VM Deltas colored status success/fail by date (the
id
is of course the epoch so that's handy), aLAST GOOD BACKUP
for deltas by hours since i.e.9 hours ago
, same again for Pool Metadata and finally a list of all VMs and their state i.e. Running/Halted.I am using the Infinity plugin to achieve it. Even without
limit
andfilter
it's still very useful to me as I had no good way to map XO backups into Grafana til I discovered the API, so many thanks for implementing! My main reason for wantinglimit
andfilter
is so the query returns less overall data (loading faster on the dash hopefully) and so I can separate out each backup job/component a bit better for manipulation (like the last good backup for that specific job). -
@DustyArmstrong
filter
andlimit
are now supported forbackups/logs
: https://github.com/vatesfr/xen-orchestra/commit/8a26e081027c5410757dcc7ae4ece6ffa7bd81a9 -
@julien-f That's awesome, thanks!
-
@julien-f Sorry to bring up again, have now updated and the limit is working, but it returns the data in reverse order (oldest backup is shown first). Is there any functionality present in the API at the moment to order it with newest first? If not no issue, I can just go back to doing it how I was.
-
Good question for @julien-f
He's not available right now, but I will remind him to take a look when he's around -
@olivierlambert Thanks! I really do appreciate the quick responses and implementations. The filter works perfectly - so does the limit of course, it's just the ordering the way it is restricts its usefulness as I need to see the most recent backup info rather than the oldest.
I did try playing around with the web UI, you can sort by ID in Backup -
/backup/overview?s_logs=1_0_desc-
- but didn't know how/if it translated to the API. -
@DustyArmstrong I'm reluctant to add a sort feature, but I think it makes sense for the limit to be applied at the end of the sorted collection
-
@julien-f EDIT: I have just seen your commit from yesterday that looks to resolve my below post! Sorry I read your comment about sorting as the
limit
ordering ("sorting") wouldn't be implemented. My query around "sorting" was in reference to exactly what you have implemented so, many thanks!@DustyArmstrong said in XO Rest API Supported Queries:
@julien-f Sorry to bring up again, have now updated and the limit is working, but it returns the data in reverse order (oldest backup is shown first). Is there any functionality present in the API at the moment to order it with newest first? If not no issue, I can just go back to doing it how I was.
-
@DustyArmstrong Perfect, thanks for your feedback
-