Red Hat Bugzilla – Bug 865861
APIs to be introduced in 1.1 return incorrect status codes
Last modified: 2014-08-04 18:31:00 EDT
Description of problem:
APIs return codes that do not conform to HTTP spec. We shouldn't fix this for APIs introduced in 1.0 (to maintain compatibility), but we should fix this for APIs to be introduced in 1.1.
The APIs to be fixed are:
* provider accounts
* hardware profiles
* pool families
Providers and provider accounts APIs are present in 1.0 as well, but only index and show actions, so fixing create/update/delete actions for 1.1 should not break compatibility.
* 200 for creating a resource
* 200 for deleting a resource (the response body is then inconsistent across our APIs, some return the resource with <status>DELETED</status>, some return just <message>OK</message>)
* 400 for failed validations on create/update
* 201 for creating a resource
* 204 for deleting a resource (and response body should be empty)
* 422 for failed validations on create/update
Pull request submitted:
Prior to cherry picking the patchset into 1.1, we will have to cherry pick these two commits:
^^ these commits don't change application code, they just refactor/extend API-related Cucumber steps and RSpec expectations.
Pushed into upstream master as:
Cherry-picked into 1.1 as:
Few observations on the response for various API request:-
1.) 201 for creating a resource
2.) 204 for deleting a resource and response body is empty
3.) 422 for failed validations on create
4.) 422 for failed validations on update
5.) 200 for update
6.) 200 for list/view resources
7.) 500 for invalid delete request (ex:deleting default pool family) with error message like the following:-
<message>The default Cloud cannot be deleted.</message>
8.) 404 for delete/update of non-existing record/resource Id, with error message like the following:-
<message>Couldn't find PoolFamily with ID=1000</message>
Please provide Info if 5,6,7,8 has expected response codes and messages.
The correctness of status code for (7) would be discussable I guess, but it wasn't discussed and I believe we have no consensus on this so far, so doing anything about (7) isn't realistic for 1.1. The rest is correct.
So yes, the codes and messages are as expected.
Assuming Point 7 to be expected behaviour for now.Verifed response code for provider/provider_accounts pool/pool_family.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.