REST API knowledge exchange
Post Reply
michelo
Novice
Posts: 3
Liked: never
Joined: Oct 20, 2022 1:52 pm
Full Name: Michel Oranje
Contact:

Backup QueryResult

Post by michelo »

Hi,

I'm trying to query backup's using the query url: api/query?format=Entities&type=Backup&filter=JobUid=="urn:veeam:Job:******"
where ****** is a existing guid.
Unfortunately it returns a "Backups" type with a list of type "Backups" instead of a list of type "Backup", is my query incorrect?

I'm requesting json.

Partial result:

Code: Select all

"Entities": {
         "Jobs": null,
         "FailoverPlans": null,
         "Backups": {
             "Backups": [
                 {
                    "Ref": null,
                    "Platform": "VMware",
                    "BackupType": "Standard",
                    "Name": "*****",
                    "UID": "urn:veeam:Backup:******",
                    "Links": [
                        {
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Backup QueryResult

Post by oleg.feoktistov »

Hi Michel,

Your query is absolutely correct. It actually returns a list of Backup types. I guess the thing that confuses you is why "Backups" property is returned once again under parent "Backups" property, correct? I think it wouldn't make sense to return "Backup" there instead since lists are not called with singular keys, they are collections. It also doesn't make sense to return "Backups" twice like it is reflected right now. I'll discuss it with developers and update this thread once we have any results.

Best regards,
Oleg
michelo
Novice
Posts: 3
Liked: never
Joined: Oct 20, 2022 1:52 pm
Full Name: Michel Oranje
Contact:

Re: Backup QueryResult

Post by michelo »

Hi Oleg,

Thank you for your reply. You are correct that the second "Bakups" confuses me, I was indeed expecting a list of "Backup" objects.
Hope to hear from you soon!

Regards, Michel
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Backup QueryResult

Post by oleg.feoktistov » 1 person likes this post

Hi Michel,

This is just to let you know that I remember about your question. Our API developer is off work, but as soon as he gets back I’ll discuss it with him and share an update.

Best regards,
Oleg
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Backup QueryResult

Post by oleg.feoktistov »

Turns out it is by design. Types for EM REST API are defined in xsd specification. It means that to form json we need to convert xml objects to json. So paths like Backups.Backups, Jobs.Jobs etc. exist because of the pecularities of xml to json conversion.
michelo
Novice
Posts: 3
Liked: never
Joined: Oct 20, 2022 1:52 pm
Full Name: Michel Oranje
Contact:

Re: Backup QueryResult

Post by michelo »

Ok, then I will have to keep using the xml variant, no problem
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest