Bug 970676 - RHEVM-DEV-GUIDE: using restapi syntax in the documentation results an error
RHEVM-DEV-GUIDE: using restapi syntax in the documentation results an error
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: Documentation (Show other bugs)
Unspecified Unspecified
unspecified Severity medium
: ---
: 3.2.0
Assigned To: Dan Macpherson
Depends On:
  Show dependency treegraph
Reported: 2013-06-04 10:50 EDT by Barak Dagan
Modified: 2015-09-22 09 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-06-06 21:22:33 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Barak Dagan 2013-06-04 10:50:22 EDT
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 11:40:46 EDT
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 12:02:16 EDT
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-06 21:22:33 EDT
No worries, Barak. Glad I could help :)

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