Project

General

Profile

Actions

Bug #10356

closed

POST and PUT should use RABL templates for the response.

Added by Bryan Kearney almost 9 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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:


Related issues 4 (0 open4 closed)

Related to Foreman - Bug #6882: POST create responses should be 201ClosedAlon Goldboim08/01/2014Actions
Related to Katello - Bug #11156: Org create API returns different wrapping and attributesResolved07/20/2015Actions
Has duplicate Foreman - Bug #11015: PUT /api/v2/architectures/:id returns an incomplete set of attributesDuplicate07/05/2015Actions
Has duplicate Foreman - Bug #11021: PUT /api/v2/config_templates/:id returns an incomplete set of attributesDuplicate07/06/2015Actions
Actions #1

Updated by Bryan Kearney almost 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

Actions #2

Updated by Dominic Cleal almost 9 years ago

  • Category set to API
Actions #3

Updated by Dominic Cleal almost 9 years ago

  • Has duplicate Bug #11015: PUT /api/v2/architectures/:id returns an incomplete set of attributes added
Actions #4

Updated by Dominic Cleal almost 9 years ago

  • Has duplicate Bug #11021: PUT /api/v2/config_templates/:id returns an incomplete set of attributes added
Actions #5

Updated by The Foreman Bot almost 9 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2519 added
  • Pull request deleted ()
Actions #6

Updated by Alon Goldboim almost 9 years ago

  • Related to Bug #6882: POST create responses should be 201 added
Actions #7

Updated by Dominic Cleal almost 9 years ago

  • Assignee set to Alon Goldboim
  • translation missing: en.field_release set to 63
Actions #8

Updated by Alon Goldboim almost 9 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #9

Updated by Dominic Cleal almost 9 years ago

  • Related to Bug #11156: Org create API returns different wrapping and attributes added
Actions

Also available in: Atom PDF