REST API knowledge exchange
Post Reply
fhabers
Novice
Posts: 6
Liked: never
Joined: Jun 05, 2020 6:55 am
Contact:

Filter attributes not working for every Query

Post by fhabers »

Hi all,

i currently try to filter my API Request.
This works perfectly:
api/query?type=BackupJobSession&filter=jobname==TestJob;result==success&format=entities&sortDesc=CreationTime&pageSize=1&page=1

But this wont work:
api/query?type=BackupTaskSession&filter=VmDisplayName==VMName;result==success&format=entities&sortDesc=CreationTime&pageSize=1&page=1

If I remove the second filter (result==success) it works again.
If I try to filter for the result wihtin the BackupTaskSession it wont work at all.
Within BackupJobSession it works.
Are the filters for the types (BackupJobSession vs. BackupTaskSession) different?

Thanks.
Fhabers
fhabers
Novice
Posts: 6
Liked: never
Joined: Jun 05, 2020 6:55 am
Contact:

Re: Filter attributes not working for every Query

Post by fhabers »

Update:
So I read the documentation regarding the Query Parameters for a BackupTaskSession and it lists the Result attribute as a parameter which can be filtered. So I'm quite confused because everytime I try to filter a BackupTaskSession for the Result I get:

Code: Select all

{"FirstChanceExceptionMessage":null,"StackTrace":null,"Message":"Failed to parse query. Format: [entities], Fields: [], SortAsc: [], SortDesc: [CreationTime], PageSize: [1], PageNum: [1], Filter: [result==success]","StatusCode":500,"Status":"InternalServerError"}
If I query for a BackupJobSession with the same parameters everything works fine.
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Filter attributes not working for every Query

Post by oleg.feoktistov » 1 person likes this post

Hi @@fhabers,

I'd start with putting "&" instead of ";" right before result==success parameter in your query for BackupTaskSession:

Code: Select all

api/query?type=BackupTaskSession&filter=VmDisplayName==VMName&result==success&format=entities&sortDesc=CreationTime&pageSize=1&page=1
Not sure why it works for BackupJobSessions though as such syntax is not correct.
Ampersand is required to separate each query parameter.

Thanks,
Oleg
fhabers
Novice
Posts: 6
Liked: never
Joined: Jun 05, 2020 6:55 am
Contact:

Re: Filter attributes not working for every Query

Post by fhabers »

Hi @oleg.feoktistov

Thanks for your reply.
Unfortunately the code provided doesn't work. I do not get an error but if I change the parameter within the result filter (e.g. from success to failed) the code provided by the API doesn't change.
The BackupTaskSession I get as a response is always with the Result "Success" (even if I change my filter to warning/failed). So the result filter gets ignored.

I use ";" as a logical "AND" Operator as described in the API reference.
What confuses me is that I cannot filter for the result at all no matter if there are two filters or just one.

But again, thanks for your help.
Fhabers
jhoughes
Veeam Vanguard
Posts: 282
Liked: 113 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Castle Rock, CO
Contact:

Re: Filter attributes not working for every Query

Post by jhoughes » 1 person likes this post

Just to confirm, what version of Enterprise Manager do you have installed, and what version of the API are you querying?
Husband, Father, Solutions Architect, Geek | @DenverVMUG & @DenverPSUG leader | International Speaker | Veeam Vanguard | vExpert (PRO) | Cisco Champion
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Filter attributes not working for every Query

Post by oleg.feoktistov » 1 person likes this post

Hi @fhabers,

I am sorry, you are right. Logical operators should be accepted. Reproduced it in my lab with v10 P2.
Raised this question with QA internally, so stay tuned. It would be also helpful to know your EM and API versions, as Joe asked.

Thanks,
Oleg
fhabers
Novice
Posts: 6
Liked: never
Joined: Jun 05, 2020 6:55 am
Contact:

Re: Filter attributes not working for every Query

Post by fhabers »

Thanks for your help.

So for the API authentication I use the SessionManager version 1.5 (api/sessionMngr/?v=v1_5).
So I guess the API Version is 1.5. Am I right?

EM Version is 10.0 (10.0.0.4461).
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Filter attributes not working for every Query

Post by oleg.feoktistov » 1 person likes this post

That's correct. Talked to QA and confirmed it as a bug, which is to be fixed in v11.
Also, temporarily removed Result field as an available query parameter from the corresponding page.
Thanks!
fhabers
Novice
Posts: 6
Liked: never
Joined: Jun 05, 2020 6:55 am
Contact:

Re: Filter attributes not working for every Query

Post by fhabers »

Hi @Oleg,

thanks for helping.
Is there a ETA for v11?
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Filter attributes not working for every Query

Post by oleg.feoktistov » 1 person likes this post

No precise ETA yet, but should be coming this year.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests