Bug 1530948

Summary: [QEDevCollab] Delete Advanced Search Filter via REST
Product: Red Hat CloudForms Management Engine Reporter: Pete Savage <psavage>
Component: APIAssignee: Gregg Tanzillo <gtanzill>
Status: CLOSED ERRATA QA Contact: Parthvi Vala <pvala>
Severity: medium Docs Contact:
Priority: high    
Version: 5.9.0CC: obarenbo, pvala, simaishi
Target Milestone: GA   
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-02-07 23:00:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:

Description Pete Savage 2018-01-04 10:01:26 UTC
Currently, we need to run this snippet of code via SSH to achieve this

"MiqSearch.where(:description => {}).first.delete"'.format(repr(filter_name)))

Could we please have this function available via REST

Comment 3 CFME Bot 2018-02-14 18:36:23 UTC
New commit detected on ManageIQ/manageiq-api/master:
https://github.com/ManageIQ/manageiq-api/commit/0de6894d8971786e8f73ed273d8b6a66dacf2b64

commit 0de6894d8971786e8f73ed273d8b6a66dacf2b64
Author:     Jillian Tullo <jtullo>
AuthorDate: Mon Jan 29 15:16:37 2018 -0500
Commit:     Jillian Tullo <jtullo>
CommitDate: Wed Feb 14 12:50:09 2018 -0500

    Allow deleting of search filters
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1530948

 app/controllers/api/search_filters_controller.rb |  4 ++
 config/api.yml                                   | 27 ++++++++
 spec/requests/collections_spec.rb                | 10 +++
 spec/requests/search_filters_spec.rb             | 84 ++++++++++++++++++++++++
 4 files changed, 125 insertions(+)
 create mode 100644 app/controllers/api/search_filters_controller.rb
 create mode 100644 spec/requests/search_filters_spec.rb

Comment 5 Parthvi Vala 2018-11-27 06:34:22 UTC
FIXED. Verified on 5.10.0.25.20181120211723_d2fd659.

Steps taken to verify:
1) Navigate to Compute > Infrastructure > Providers.
2) Create an advanced search filter.
3) Get the filter ID.
4) Send Request. Tested with 3 different requests.
    1. Request: POST /api/search_filters/:id
       Query: {"action" : "delete"}
    2. Request: DELETE /api/search_filters/:id
    3. Request: POST /api/search_filters
       Query: {
                "action": "delete",
                "resources": [
		   {"id": ":id" ,
                    "href": "https://<ip_address>/api/search_filters/:id",
                    "description": "my_filter"
		   }
                 ]
              }
Response: {
	"results": [
		{
			"success": true,
			"message": "search_filters id: :id deleting",
			"href": "https://<ip_address>/api/search_filters/:id"
		}
	]
}

Comment 6 errata-xmlrpc 2019-02-07 23:00:52 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://access.redhat.com/errata/RHSA-2019:0212