Bug #8017
closed*_ids attributes have to be wrapped in an extra hash
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1151220
Description of problem:
Clients must submit a nested hash of attributes to certain API URLs.
For example, POSTing this data to the `/architectures` URL will succeed:
{'name': 'foo'}
However, these operating system IDs will be silently ignored:
{'name': 'foo', 'operatingsystem_ids': [1, 2, 3]}
A client can hack around this oddity by wrapping submitted data inside an extra hash:
{'architecture': {'name': 'foo', 'operatingsystem_ids': [1, 2, 3]}}
This extra hash should not be necessary. It makes the API harder to use, and the extra hash is only required for some API calls.
Version-Release number of selected component (if applicable):
This was tested against a system running Satellite 6.0.4, running the following software:
- candlepin-0.9.23-1.el7.noarch
- candlepin-common-1.0.1-1.el7.noarch
- candlepin-guice-3.0-2_redhat_1.el7.noarch
- candlepin-scl-1-5.el7.noarch
- candlepin-scl-quartz-2.1.5-6.el7.noarch
- candlepin-scl-rhino-1.7R3-3.el7.noarch
- candlepin-scl-runtime-1-5.el7.noarch
- candlepin-selinux-0.9.23-1.el7.noarch
- candlepin-tomcat-0.9.23-1.el7.noarch
- elasticsearch-0.90.10-6.el7sat.noarch
- foreman-1.6.0.46-1.el7sat.noarch
- foreman-compute-1.6.0.46-1.el7sat.noarch
- foreman-gce-1.6.0.46-1.el7sat.noarch
- foreman-libvirt-1.6.0.46-1.el7sat.noarch
- foreman-ovirt-1.6.0.46-1.el7sat.noarch
- foreman-postgresql-1.6.0.46-1.el7sat.noarch
- foreman-proxy-1.6.0.30-1.el7sat.noarch
- foreman-selinux-1.6.0.14-1.el7sat.noarch
- foreman-vmware-1.6.0.46-1.el7sat.noarch
- katello-1.5.0-30.el7sat.noarch
- katello-certs-tools-1.5.6-1.el7sat.noarch
- katello-default-ca-1.0-1.noarch
- katello-installer-0.0.64-1.el7sat.noarch
- katello-server-ca-1.0-1.noarch
- openldap-2.4.39-3.el7.x86_64
- pulp-katello-0.3-4.el7sat.noarch
- pulp-nodes-common-2.4.1-0.7.beta.el7sat.noarch
- pulp-nodes-parent-2.4.1-0.7.beta.el7sat.noarch
- pulp-puppet-plugins-2.4.1-0.7.beta.el7sat.noarch
- pulp-puppet-tools-2.4.1-0.7.beta.el7sat.noarch
- pulp-rpm-plugins-2.4.1-0.7.beta.el7sat.noarch
- pulp-selinux-2.4.1-0.7.beta.el7sat.noarch
- pulp-server-2.4.1-0.7.beta.el7sat.noarch
- python-ldap-2.4.6-6.el7.x86_64
- ruby193-rubygem-net-ldap-0.3.1-3.el7sat.noarch
- ruby193-rubygem-runcible-1.1.0-2.el7sat.noarch
How reproducible:
100%, but only for some URLs. The following URLs are currently known to require this workaround:
- architectures
- media
- operatingsystems
Steps to Reproduce:
See "description of problem" at top of bug report.
Actual results:
An extra hash is required.
Expected results:
No extra hash is required.
Additional info:
The following is taken from the log file. It shows what the server receives when processing a POST call to `/api/v2/architectures`.
Processing by Api::V2::ArchitecturesController#create as JSON
Parameters: {"name"=>"<U+FA685>\u{BCF6F}