Reproduced this with 2 http proxies - "TestProxy" and "TestProxy2". Using hammer
hammer repository create --name VijayTest2 --product-id 2 --content-type yum --url 'https://repos.fedorapeople.org/repos/pulp/pulp/fixtures/srpm/' --http-proxy TestProxy --http-proxy-policy use_selected_http_proxy
Hammer invokes an API request:
14:13:21 rails.1 | 2019-11-01T14:13:21 [I|app|b1971d02] Started GET "/api/http_proxies?name=TestProxy&per_page=1000&page=1" for 192.168.121.219 at 2019-11-01 14:13:21 +0000
14:13:21 rails.1 | 2019-11-01T14:13:21 [I|app|b1971d02] Processing by Api::V2::HttpProxiesController#index as JSON
14:13:21 rails.1 | 2019-11-01T14:13:21 [I|app|b1971d02] Parameters: {"name"=>"TestProxy", "per_page"=>"1000", "page"=>"1", "apiv"=>"v2", "http_proxy"=>{}}
14:13:21 rails.1 | 2019-11-01T14:13:21 [D|app|b1971d02] Authenticated user admin against INTERNAL authentication source
14:13:21 rails.1 | 2019-11-01T14:13:21 [I|app|b1971d02] Authorized user admin(Admin User)
14:13:21 rails.1 | 2019-11-01T14:13:21 [D|tax|b1971d02] Current location set to none
14:13:21 rails.1 | 2019-11-01T14:13:21 [D|tax|b1971d02] Current organization set to none
14:13:21 rails.1 | 2019-11-01T14:13:21 [D|tax|b1971d02] Current location set to none
14:13:21 rails.1 | 2019-11-01T14:13:21 [D|tax|b1971d02] Current organization set to none
14:13:21 rails.1 | 2019-11-01T14:13:21 [I|app|b1971d02] Rendering api/v2/http_proxies/index.json.rabl within api/v2/layouts/index_layout
14:13:21 rails.1 | 2019-11-01T14:13:21 [I|app|b1971d02] Rendered api/v2/http_proxies/index.json.rabl within api/v2/layouts/index_layout (17.0ms)
14:13:21 rails.1 | 2019-11-01T14:13:21 [D|app|b1971d02] Body: {
14:13:21 rails.1 | | "total": 2,
14:13:21 rails.1 | | "subtotal": 2,
14:13:21 rails.1 | | "page": 1,
14:13:21 rails.1 | | "per_page": 1000,
14:13:21 rails.1 | | "search": null,
14:13:21 rails.1 | | "sort": {
14:13:21 rails.1 | | "by": null,
14:13:21 rails.1 | | "order": null
14:13:21 rails.1 | | },
14:13:21 rails.1 | | "results": [{"id":1,"name":"TestProxy","url":"http://192.168.1.112","username":"admin"},{"id":2,"name":"TestProxy2","url":"http://192.168.1.121:8888","username":""}]
14:13:21 rails.1 | | }
While the parameter is actually the name of one of the http proxies, the list returned is actually all http proxies that match that name. The supplied name is a search, and not a unique identifier according to how the API controller is implemented.
See https://github.com/theforeman/foreman/blob/develop/app/controllers/api/v2/http_proxies_controller.rb.