Actions
Bug #7975
closedQuerying subnets by name no longer works
Description
When querying subnets via the API, only querying by ID works, not querying by name. Example:
curl -s -k -u admin:changeme https://r6-staypuft/api/subnets | python -m json.tool [ { "subnet": { "dhcp_id": 1, "dns_id": 1, "dns_primary": "192.168.130.5", "dns_secondary": null, "domain_ids": [ 1 ], "from": "192.168.130.100", "gateway": "192.168.130.1", "id": 1, "ipam": "DHCP", "mask": "255.255.255.0", "name": "default", "network": "192.168.130.0", "priority": null, "tftp_id": 1, "to": "192.168.130.254", "vlanid": null } } ] [root@r6-staypuft ~]# curl -s -k -u admin:changeme https://r6-staypuft/api/subnets/1 | python -m json.tool { "subnet": { "cidr": 24, "dhcp": { "id": 1, "name": "r6-staypuft.example.org", "url": "https://r6-staypuft.example.org:8443" }, "dhcp_id": 1, "dns": { "id": 1, "name": "r6-staypuft.example.org", "url": "https://r6-staypuft.example.org:8443" }, "dns_id": 1, "dns_primary": "192.168.130.5", "dns_secondary": null, "domain_ids": [ 1 ], "from": "192.168.130.100", "gateway": "192.168.130.1", "id": 1, "ipam": "DHCP", "mask": "255.255.255.0", "name": "default", "network": "192.168.130.0", "priority": null, "tftp": { "id": 1, "name": "r6-staypuft.example.org", "url": "https://r6-staypuft.example.org:8443" }, "tftp_id": 1, "to": "192.168.130.254", "vlanid": null } } [root@r6-staypuft ~]# curl -s -k -u admin:changeme https://r6-staypuft/api/subnets/default | python -m json.tool { "message": "Resource subnet not found by id 'default'" }
Updated by Dominic Cleal about 10 years ago
- Category set to API
- Target version set to 1.7.2
- Translation missing: en.field_release set to 21
Updated by Shlomi Zadok about 10 years ago
- Status changed from New to Feedback
- Assignee set to Shlomi Zadok
On subnets, we use a combination of the id & name (as defined in def to_param
, see subnet.rb )
The right api call would be curl -s -k -u admin:changeme https://r6-staypuft/api/subnets/1-default | python -m json.tool
Updated by Dominic Cleal about 10 years ago
- Status changed from Feedback to New
The API should accept the ID or the name as per the docs (http://theforeman.org/manuals/1.6/index.html#5.1API). We've never used "id-name" as an identifier in the API.
Updated by The Foreman Bot about 10 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/1867 added
- Pull request deleted (
)
Updated by Shlomi Zadok about 10 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 4af1e2bacaa43c7dc3bb535cb087a6584b87719e.
Actions