Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be unavailable on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 970676 - RHEVM-DEV-GUIDE: using restapi syntax in the documentation results an error
Summary: RHEVM-DEV-GUIDE: using restapi syntax in the documentation results an error
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: Documentation
Version: 3.2.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 3.2.0
Assignee: Dan Macpherson
QA Contact: ecs-bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2013-06-04 14:50 UTC by Barak Dagan
Modified: 2015-09-22 13:09 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2013-06-07 01:22:33 UTC
oVirt Team: ---
Target Upstream Version:

Attachments (Terms of Use)

Description Barak Dagan 2013-06-04 14:50:22 UTC
Description of problem:
Using the syntax in the documentation results an error, since -H "Content-type: application/xml" is missing.
 Example_Access_API_Entry_Point.html) :

 curl -X GET -H "Accept: application/xml" -u [USERASS] \
     --cacert [CERT] \
     https://[RHEVM Host]:443/api/

 my command:
 $ curl -X GET -H "Accept: application/xml" -u [admin@internal:passowrd] --cacert rhevm.cer https://vm-161-12.....redhat.com:443/api/
 <html><head><title>JBoss Web/7.2.0.Final-redhat-1 - JBWEB000064: Error
 font-size:22px;} H2
 font-size:16px;} H3
 font-size:14px;} BODY
 {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B
 12px;}A {color : black;}A.name {color : black;}HR {color :
 #525D76;}--></style> </head><body><h1>JBWEB000065: HTTP Status 401 -
 </h1><HR size="1" noshade="noshade"><p><b>JBWEB000309: type</b> JBWEB000067:
 Status report</p><p><b>JBWEB000068: message</b>
 <u></u></p><p><b>JBWEB000069: description</b> <u>JBWEB000121: This request
 requires HTTP authentication.</u></p><HR size="1"
 noshade="noshade"><h3>JBoss Web/7.2.0.Final-redhat-1</h3></body></html>

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:

Actual results:

Expected results:

Additional info:

Comment 1 Dan Macpherson 2013-06-04 15:40:46 UTC
Hi Barak,

The problem isn't the lack of the Content-Type header. Content-Type is only used when you have a body, which GET requests do not. Content-Type is needed for POST, PUT and some DELETE requests.

The problem is actually with authentication as per the output that states a 401 HTTP error. My guess is there's a problem with the curl command you're using.

Your curl syntax looks fine. The only thing I can see that seems out of place is you've included the square brackets around admin@internal:password, which would explain the 401 authentication error. With the square brackets it interprets your username as [admin@internal and your password as password].

Can you confirm if this is the case?

Comment 2 Barak Dagan 2013-06-05 16:02:16 UTC
Hi Dan, 

1st, thanks for explaining the content-type usage :).
2nd your analysis is right, removing the square brackets does work, (also adding the content-type to the get command - which lead me to the wrong conclusion).

It is up to you if that documentation need to be fixed (since I failed using the curl command with the syntax I copied from it, but maybe the clients know better)

Comment 3 Dan Macpherson 2013-06-07 01:22:33 UTC
No worries, Barak. Glad I could help :)

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