Bug 867794

Summary: [RFE] print usage information to error page when API user calls POST action incorrectly
Product: Red Hat Enterprise Virtualization Manager Reporter: David Jaša <djasa>
Component: ovirt-engine-restapiAssignee: Ori Liel <oliel>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Beňas <pbenas>
Severity: low Docs Contact:
Priority: unspecified    
Version: 3.1.0CC: aberezin, acathrow, bazulay, ecohen, iheim, jkt, juan.hernandez, lbopf, oramraz, pbenas, pstehlik, Rhev-m-bugs
Target Milestone: ---Keywords: FutureFeature
Target Release: 3.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
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: Environment:
Last Closed: 2014-06-12 14:03:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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