Bug #10356
closedPOST and PUT should use RABL templates for the response.
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1216236
Description of problem:
The API returns significantly different information for the following two calls:
- POST /api/v2/locations
- GET /api/v2/locations/:id
This is problematic for two reasons:
- This is inconsistent with how other paths behave, which makes writing client code harder to do.
- Getting authoritative information about a just-created location requires a follow-up API call, which is time-consuming.
Version-Release number of selected component (if applicable):
Tested against Satellite-6.1.0-RHEL-6-20150424.0 and Satellite-6.1.0-RHEL-7-20150424.0.
How reproducible:
100%
Steps to Reproduce:
Here's a sample script:
>>> from nailgun import entities
>>> loc_attrs = entities.Location().create_json()
>>> loc_attrs2 = entities.Location(id=loc_attrs['id']).read_json()
>>> loc_attrs.keys() # contents of response to POST call
[
u'ancestry',
u'apply_info_task_id',
u'created_at',
u'default_info',
u'description',
u'id',
u'ignore_types',
u'katello_default',
u'label',
u'name',
u'title',
u'updated_at',
]
>>> loc_attrs2.keys() # contents of response to GET call
[
u'compute_resources',
u'config_templates',
u'created_at',
u'description',
u'domains',
u'environments',
u'hostgroups',
u'id',
u'media',
u'name',
u'organizations',
u'parameters',
u'select_all_types',
u'smart_proxies',
u'subnets',
u'title',
u'updated_at',
u'users',
]
Actual results:
The actual results are as shown in the above example.
Expected results:
Both POST and GET requests should return the same information.
Additional info:
Updated by Bryan Kearney over 9 years ago
- Subject changed from POST /api/v2/locations returns an incomplete set of attributes to POST and PUT should use RABL templates for the response.
This was a known issue that the response of POST/PUT is just the object and it doesn't use a RABL template (render :json => @object), whereas the GET :id included all the relationships which are in the RABL template show.json.rabl
Updated by Dominic Cleal over 9 years ago
- Has duplicate Bug #11015: PUT /api/v2/architectures/:id returns an incomplete set of attributes added
Updated by Dominic Cleal over 9 years ago
- Has duplicate Bug #11021: PUT /api/v2/config_templates/:id returns an incomplete set of attributes added
Updated by The Foreman Bot over 9 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2519 added
- Pull request deleted (
)
Updated by Alon Goldboim over 9 years ago
- Related to Bug #6882: POST create responses should be 201 added
Updated by Dominic Cleal over 9 years ago
- Assignee set to Alon Goldboim
- Translation missing: en.field_release set to 63
Updated by Alon Goldboim over 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset d575926a689fd6abd6f26ee2823ce95eef07dd38.
Updated by Dominic Cleal over 9 years ago
- Related to Bug #11156: Org create API returns different wrapping and attributes added