Bug 867794 - [RFE] print usage information to error page when API user calls POST action incorrectly
Summary: [RFE] print usage information to error page when API user calls POST action i...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi
Version: 3.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
: 3.4.0
Assignee: Ori Liel
QA Contact: Petr Beňas
URL:
Whiteboard: infra
: 913695 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-18 10:10 UTC by David Jaša
Modified: 2016-02-10 19:14 UTC (History)
12 users (show)

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.
Clone Of:
Environment:
Last Closed: 2014-06-12 14:03:40 UTC
oVirt Team: Infra
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2014:0506 0 normal SHIPPED_LIVE Moderate: Red Hat Enterprise Virtualization Manager 3.4.0 update 2014-06-09 18:55:38 UTC
oVirt gerrit 26706 0 master MERGED restapi: Return additional info for 400 messages Never
oVirt gerrit 26787 0 ovirt-engine-3.4 MERGED restapi: Return additional info for 400 messages Never

Description David Jaša 2012-10-18 10:10:29 UTC
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:
always

Steps to Reproduce:
1. run curl ... -X POST "garbage" https://rhevm.example.org/api/vms/<vm_uuid>/ticket
2.
3.
  
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):

<action>
    ...
    <correct-usage>
        <ticket>
            <!-- mandatory -->
            <expiry>
                <!-- integer, optional: number of seconds when password
                     is valid. Default: 7200, Default in Portal: 120 -->
            </expiry>
        </ticket>
    </correct-usage>
</action>

Additional info:

Comment 1 Michael Pasternak 2013-10-07 09:53:57 UTC
*** Bug 913695 has been marked as a duplicate of this bug. ***

Comment 2 Michael Pasternak 2013-10-08 10:57:44 UTC
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 12:50:56 UTC
http://gerrit.ovirt.org/#/c/23017/

Comment 6 Petr Beňas 2014-04-10 14:55:32 UTC
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 15:06:51 UTC
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 12:21:03 UTC
Verified in av7.

Comment 9 Itamar Heim 2014-06-12 14:03:40 UTC
Closing as part of 3.4.0


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