Project

General

Profile

Actions

Bug #10356

closed

POST and PUT should use RABL templates for the response.

Added by Bryan Kearney about 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

Also available in: Atom PDF