Bug 1337240 - When using v4 rest api with request, which is valid for v3 compatibility requests, incorrect suggestion how request should look like is offered by system
Summary: When using v4 rest api with request, which is valid for v3 compatibility requ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 4.0.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ovirt-4.0.2
: 4.0.2.1
Assignee: Ori Liel
QA Contact: Lukas Svaty
URL:
Whiteboard:
: 1361079 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-05-18 15:11 UTC by Martin Mucha
Modified: 2016-08-12 14:21 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-08-12 14:21:24 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-4.0.z+
mgoldboi: exception+
rule-engine: planning_ack+
mperina: devel_ack+
lsvaty: testing_ack+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 59628 0 'None' MERGED restapi: Issue Usage Message For Bad Request 2020-09-24 19:55:56 UTC
oVirt gerrit 60710 0 'None' MERGED restapi: Issue Usage Message For Bad Request 2020-09-24 19:55:56 UTC
oVirt gerrit 61117 0 'None' MERGED restapi: Issue Usage Message For Bad Request 2020-09-24 19:55:51 UTC

Description Martin Mucha 2016-05-18 15:11:01 UTC
Description of problem:
When using v4 rest api with request, which is valid for v3 compatibility requests, incorrect suggestion how request should look like is offered by system

I removed certain field from DataCenter resource and moved it to V3DataCenter and initialize it using it's adapters. If I use this field from non-v3 api, error is produced, but in suggestion there's mention of this inexisting field:

<parameter required="false" type="xs:string">
<name>datacenter.mac_pool.id</name>
</parameter>


How reproducible:
100%



Expected results:
Given suggestion should not be made.

Comment 1 Marcin Mirecki 2016-05-30 09:13:45 UTC
There same problem occurns in:
api/openstacknetworkproviders/

The type property is missing from the descriptions

Comment 2 Juan Hernández 2016-05-30 11:54:06 UTC
The problem here is that there isn't a RSDL for version 4 of the API, we have a description of the model instead, available in the following URLs:

  /ovirt-engine/api/model.xml
  /ovirt-engine/api/model.json
  /ovirt-engine/api/model.html (this isn't available yet)

Most probably we will fix this bug changing the way we report errors. Instead of returning the RSDL for the operation we will return a link to the relevant section of the documentation, where all the details of the operation and the types used will be available.

Comment 3 Juan Hernández 2016-05-30 11:56:05 UTC
I'm requesting flags for 4.0.1, as I think we won't be able to fix this for 4.0.0.

Comment 4 Marcin Mirecki 2016-05-30 12:24:15 UTC
Better description of the problem for openstacknetworkproviders:

Issuing a syntactically incorrect request, for example

POST: http://localhost:8080/ovirt-engine/api/openstacknetworkproviders/
<garbage>

results in:  400 Bad Request
with the body containing a description on how the request should be formated, for example:

<usage_message>
    <message>Request syntactically incorrect. See the description below for the correct usage:</message>
    <detailedLink href="/ovirt-engine/api/openstacknetworkproviders" rel="add"><description>add a new OpenStack network provider to the system</description>
        <request><http_method>POST</http_method>
            <headers>
                <header required="false">  <name>Correlation-Id</name><value>any string</value> </header>
                <header required="true"> <name>Content-Type</name> <value>application/xml|json</value> </header>
            </headers>
            <body>
                <type>OpenStackNetworkProvider</type>
                <parameters_set>
                    <description>add a new OpenStack network provider to the system</description>
                    <parameter required="true" type="xs:string"> <name>openstack_network_provider.name</name> </parameter>
                    <parameter required="false" type="collection"><name>openstack_network_provider.properties.property</name></parameter>
                    <parameter required="false" type="xs:string"><name>openstack_network_provider.tenant_name</name> </parameter>
...


The problem is that this reply does not list the full set of parameters.
For example, in case of /ovirt-engine/api/openstacknetworkproviders we are missing the "type" parameter.

Comment 5 Juan Hernández 2016-07-14 08:47:21 UTC
In version 4 of the API the returned for incorrect results will be a link to the documentation. For example, the following request:

  POST: https://engine.example.com/ovirt-engine/api/openstacknetworkproviders
  <garbage>

Will produce the following response:

  <fault>
    <reason>Request syntactically incorrect.</reason>
    <detail>For correct usage, see: https://engine.example.com/ovirt-engine/api/model#services/openstack-network-providers/methods/add</detail>
  </fault>

Comment 6 Ori Liel 2016-07-28 11:46:59 UTC
*** Bug 1361079 has been marked as a duplicate of this bug. ***

Comment 7 Lukas Svaty 2016-07-29 12:43:17 UTC
verified in ovirt-engine-restapi-4.0.2.1-0.1.el7ev.noarch

[lsvaty@nope ~]$ curl -k -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" -u admin@internal:*password* --cacert ca.crt -d "<test></test>" https://*hostname*:443/ovirt-engine/api/vms
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<fault>
    <detail>For correct usage, see: https://*hostname*/ovirt-engine/api/v4/model#services/vms/methods/add</detail>
    <reason>Request syntactically incorrect.</reason>
</fault>


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