You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ambari.apache.org by "Doroszlai, Attila (JIRA)" <ji...@apache.org> on 2017/10/11 08:36:00 UTC

[jira] [Commented] (AMBARI-22195) Ambari create cluster API requests outputs invalid JSON

    [ https://issues.apache.org/jira/browse/AMBARI-22195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16199964#comment-16199964 ] 

Doroszlai, Attila commented on AMBARI-22195:
--------------------------------------------

[~leontp587],  HTTP headers are normally not part of the JSON.  Something in your environment must be converting the response to JSON and wrapping the original body under "content".

{noformat:title=curl --include --header "X-Requested-By:ambari" -u admin:admin http://localhost:8080/api/v1/clusters/TEST/requests/1}
HTTP/1.1 200 OK
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Cache-Control: no-store
Pragma: no-cache
Set-Cookie: AMBARISESSIONID=4nb92ayj93m71alhz9ou19iqk;Path=/;HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
User: admin
Content-Type: text/plain
Vary: Accept-Encoding, User-Agent
Content-Length: 1711

{
  "href" : "http://localhost:8080/api/v1/clusters/TEST/requests/1",
  "Requests" : {
    "aborted_task_count" : 0,
    "cluster_host_info" : "{}",
    "cluster_name" : "TEST",
    "completed_task_count" : 0,
...
{noformat}

> Ambari create cluster API requests outputs invalid JSON
> -------------------------------------------------------
>
>                 Key: AMBARI-22195
>                 URL: https://issues.apache.org/jira/browse/AMBARI-22195
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-sever
>    Affects Versions: 2.5.0
>         Environment: RedHat 7
> But likely not related to OS
>            Reporter: Leon Li
>            Priority: Minor
>              Labels: easyfix
>
> The Ambari cluster creation request status API outputs invalid JSON.
> curl -u admin:admin http://ambari:8080/api/v1/clusters/clustername/requests/1
> Output:
> {
>         "cache_control": "no-store", 
>         "changed": false, 
>         "connection": "close", 
>         "content": {color:red}"{color}{
> 			"href" : "http://ambari:8080/api/v1/clusters/clustername/requests/1",
> 			"Requests" : {
> 			"id" : 1,
> 			"status" : 
> 			"Accepted"
> 			}
> 			}{color:red}"{color}, 
>         "content_type": "text/plain", 
>         "expires": "Thu, 01 Jan 1970 00:00:00 GMT", 
>         "msg": "OK (unknown bytes)", 
>         "pragma": "no-cache", 
>         "redirected": false, 
>         "server": "Jetty(8.1.19.v20160209)", 
>         "set_cookie": "AMBARISESSIONID=qaf5s3s9epkdjl823y7zx5f9g57;Path=/;HttpOnly", 
>         "status": 202, 
>         "url": "http://ambari:8080/api/v1/clusters/clustername", 
>         "user": "admin", 
>         "vary": "Accept-Encoding, User-Agent", 
>         "x_content_type_options": "nosniff", 
>         "x_frame_options": "DENY", 
>         "x_xss_protection": "1; mode=block"
>     }
> The content field value should not be enclosed in quotes.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)