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" : "...." }, ... ] }
https://github.com/ManageIQ/manageiq/pull/11372
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(-)
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".