Bug 1173096 - Support for Filtering child resources
Summary: Support for Filtering child resources
Status: CLOSED ERRATA
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: REST
Version: JON 3.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ER01
: JON 3.3.3
Assignee: Libor Zoubek
QA Contact:
URL:
Whiteboard:
Keywords: Triaged
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-11 12:54 UTC by Libor Zoubek
Modified: 2015-11-02 00:44 UTC (History)
7 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2015-07-30 16:41:21 UTC


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:1525 normal SHIPPED_LIVE Moderate: Red Hat JBoss Operations Network 3.3.3 update 2015-07-30 20:41:08 UTC

Description Libor Zoubek 2014-12-11 12:54:21 UTC
Description of problem:

Our REST API is not capable of filtering child resources by category or any other criteria. The only way clients have is to get all child resources from API and filter results in memory.

Version-Release number of selected component (if applicable):
JON 3.3.0.GA

How reproducible: always


I think we should at least implement an easy filter for GET /resource/{id}/children that could accept the same @QueryParams as /resource

but I'd like to introduce something more powerful. Let's say GET /resource/search

where query parameter i.e "parentResourceId=2" would be mapped to ResourceCriteria#addFilterParentResourceId(2)

This search endpoint would be generic enough to support all filter options we have + we can introduce some special queryParams like strict=false|true. GET /resource/search would be a better (more general) replacement for  GET /resource/{id}/children

Comment 1 Libor Zoubek 2015-04-08 14:13:35 UTC
in master

b3de3e99b29ef1fa3a1dceb6551f5a6a470145a0
e1e7bc3cf9ae963711e44b23b9f51f06a7eafb36

Comment 2 Larry O'Leary 2015-04-10 14:47:08 UTC
As this is already supported via the Java API and it does not make sense that our APIs implement a completely separate set of functions, one could argue that this is a bug. Furthermore, the fact that you have to retrieve all the child resources means that the client application would most likely require a very large amount of memory and therefore the result of using the resource/{id}/children endpoint could result in memory errors without a way for the user to get around them.

This fix should be considered for the 3.3 stream to improve user-experience and make the REST API more usable and aligned with the Java API.

Setting target to 3.3.3 for consideration in next maintenance release.

Comment 4 Simeon Pinder 2015-07-10 18:55:35 UTC
Available for test with 3.3.3 ER01 build: 
https://brewweb.devel.redhat.com/buildinfo?buildID=446732
 *Note: jon-server-patch-3.3.0.GA.zip maps to ER01 build of
 jon-server-3.3.0.GA-update-03.zip.

Comment 7 Jeeva Kandasamy 2015-07-21 11:25:22 UTC
Executed the following queries and works as expected,

http://<hostname:port>/rest/resource/search?parentId=10003&ps=100
http://<hostname:port>/rest/resource/search?parentId=10003&ps=100&availability=DOWN
http://<hostname:port>/rest/resource/search?parentId=10003&ps=100&availability=UP
http://<hostname:port>/rest/resource/search?plugin=JBossAS7&ps=100&availability=UP
http://<hostname:port>/rest/resource/search?plugin=JBossAS7&ps=100&availability=UP
http://<hostname:port>/rest/resource/search?status=COMMITTED
http://<hostname:port>/rest/resource/search?status=NEW
http://<hostname:port>/rest/resource/search?status=COMMITTED&category=Platform
http://<hostname:port>/rest/resource/search?status=COMMITTED&category=Server&parentName=rhq
http://<hostname:port>/rest/resource/search?status=COMMITTED&category=Server&parentName=rhq&type=Cassandra Server JVM
http://<hostname:port>/rest/resource/search?type=Cassandra Server JVM
http://<hostname:port>/rest/resource/search?type=File System


Build Information: 
Version : 3.3.0.GA Update 03
Build Number : e4b348a:2f80c8c

Comment 9 errata-xmlrpc 2015-07-30 16:41:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-1525.html


Note You need to log in before you can comment on or make changes to this bug.