Bug 970676

Summary: RHEVM-DEV-GUIDE: using restapi syntax in the documentation results an error
Product: Red Hat Enterprise Virtualization Manager Reporter: Barak Dagan <bdagan>
Component: DocumentationAssignee: Dan Macpherson <dmacpher>
Status: CLOSED NOTABUG QA Contact: ecs-bugs
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.2.0CC: acathrow, dyasny, gklein, pstehlik, yeylon
Target Milestone: ---   
Target Release: 3.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-07 01:22:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.
(https://access.redhat.com/site/documentation/en-US/
 Red_Hat_Enterprise_Virtualization/3.2-Beta/html/Developer_Guide/
 Example_Access_API_Entry_Point.html) :

 Example:
 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
 report</title><style><!--H1
 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;
 font-size:22px;} H2
 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;
 font-size:16px;} H3
 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;
 font-size:14px;} BODY
 {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B
 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
 P
 {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:
 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):
SF17.3

How reproducible:
100%

Steps to Reproduce:
1.
2.
3.

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 :)