Bug 867794 - [RFE] print usage information to error page when API user calls POST action incorrectly
[RFE] print usage information to error page when API user calls POST action i...
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi (Show other bugs)
Unspecified Unspecified
unspecified Severity low
: ---
: 3.4.0
Assigned To: Ori Liel
Petr Beňas
: FutureFeature
: 913695 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 2012-10-18 06:10 EDT by David Jaša
Modified: 2016-02-10 14:14 EST (History)
12 users (show)

See Also:
Fixed In Version: org.ovirt.engine-root-3.4.0-14
Doc Type: Enhancement
Doc Text:
When a user issues a POST or PUT request in the REST API, and the body is malformed, the application now identifies, according to the context, what the user was trying to do, and returns the correct usage from RSDL.
Story Points: ---
Clone Of:
Last Closed: 2014-06-12 10:03:40 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: Infra
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 26706 master MERGED restapi: Return additional info for 400 messages Never
oVirt gerrit 26787 ovirt-engine-3.4 MERGED restapi: Return additional info for 400 messages Never

  None (edit)
Description David Jaša 2012-10-18 06:10:29 EDT
Description of problem:
This is an extension of bug 867772 to behave similarly to unix command line programs that print basic usage to stderr if they are called incorrectly.

This is mainly useful for people building stuff on top of rest API or people who have to use REST API for debugging because in such cases, typos or forgetting exact names are inevitable and this reduces times spent by digging in documentation greatly.

Version-Release number of selected component (if applicable):
3.1.0-18 / si19.1

How reproducible:

Steps to Reproduce:
1. run curl ... -X POST "garbage" https://rhevm.example.org/api/vms/<vm_uuid>/ticket
Actual results:
generic HTTP error page is served

Expected results:
include correct usage information. Given that the reply is itself XML, it could include subtree like this (I may request too verbose answer but I can imagine that printing defaults could save considerable effort on debugging of some issues):

            <!-- mandatory -->
                <!-- integer, optional: number of seconds when password
                     is valid. Default: 7200, Default in Portal: 120 -->

Additional info:
Comment 1 Michael Pasternak 2013-10-07 05:53:57 EDT
*** Bug 913695 has been marked as a duplicate of this bug. ***
Comment 2 Michael Pasternak 2013-10-08 06:57:44 EDT
only use-case that makes sense is a formatting errors producing marshalling 
exceptions, all other are covered by specific engine/api errors.
Comment 3 Ori Liel 2014-01-06 07:50:56 EST
Comment 6 Petr Beňas 2014-04-10 10:55:32 EDT
I don't get any detailed info for posting to /api/tags nor vms/<vm_uuid>/ticket. 
I'm always getting <?xml version="1.0" encoding="UTF-8" standalone="yes"?><fault><reason>Bad Request</reason></fault>.
Comment 7 Juan Hernández 2014-04-16 11:06:51 EDT
The change has been merged to the upstream 3.4 branch, so it will be available with the next rebase.
Comment 8 Petr Beňas 2014-04-28 08:21:03 EDT
Verified in av7.
Comment 9 Itamar Heim 2014-06-12 10:03:40 EDT
Closing as part of 3.4.0

Note You need to log in before you can comment on or make changes to this bug.