Bug 1352044 - [RFE] Add support for Bulk queries
Summary: [RFE] Add support for Bulk queries
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: unspecified
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: GA
: 5.8.0
Assignee: abellott
QA Contact: Martin Kourim
URL:
Whiteboard:
Depends On:
Blocks: 1391718
TreeView+ depends on / blocked
 
Reported: 2016-07-01 13:28 UTC by abellott
Modified: 2017-06-12 16:58 UTC (History)
5 users (show)

Fixed In Version: 5.8.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1391718 (view as bug list)
Environment:
Last Closed: 2017-06-12 16:58:43 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description abellott 2016-07-01 13:28:45 UTC
While the current interfaces support bulk actions on operate/control operations on resources, there is a need to support bulk queries.  

Seperate than a filtered search, this is the case where customers have a list of resource identifiers, (id, guid, name, etc) that need to be queried for additional details/attributes.

Implementing this by a GET parameter will be limited by character size (i.e. by_guid=guid1,guid2,...) 

We need to support a new action "query" for all collections.  This can be implemented in a generic way, but supporting different identifiers based on the collection, i.e. id, href for all, but guid for vms, hosts, etc. description for groups, etc.

Role identifier for the new action would be the same as the resource :read action in api.yml (for Rbac purposes).

Example usage would be:


POST /api/vms?attributes=power_state,tools_status,....

{
   "action" : "query",
   "resources" : [
      { "guid" : "...." },
      { "guid" : "...." },
      ...
   ]
}

Comment 3 CFME Bot 2016-09-23 13:26:28 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/3df001c49095a7fe70f01abbedba563b7a448f11

commit 3df001c49095a7fe70f01abbedba563b7a448f11
Author:     Alberto Bellotti <abellott>
AuthorDate: Mon Sep 19 13:35:00 2016 -0400
Commit:     Alberto Bellotti <abellott>
CommitDate: Tue Sep 20 11:33:35 2016 -0400

    Enhancement to bulk queries to support collection referencing attributes
    
    - Support current name, description, etc.
    - Also support guid if defined in the model.
    - Updated specs
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1352044

 app/controllers/api/base_controller/generic.rb |  6 +++++-
 app/controllers/api/base_controller/manager.rb |  5 ++++-
 app/controllers/api/base_controller/parser.rb  | 13 ++++++-------
 config/api.yml                                 |  4 ++++
 spec/requests/api/collections_spec.rb          | 14 ++++++++++----
 5 files changed, 29 insertions(+), 13 deletions(-)

Comment 5 Martin Kourim 2017-04-10 11:50:51 UTC
Verified on 5.8.0.9-alpha2 that bulk query works on /api/events with "id", "href" and "guid", on /api/users with "name" and "userid", on /api/roles with "name" and on /api/users with "description".


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