ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Tucker (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AMBARI-9016) API not taking or responding with application/json
Date Tue, 03 Nov 2015 07:00:33 GMT

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

David Tucker commented on AMBARI-9016:
--------------------------------------

+1

> API not taking or responding with application/json
> --------------------------------------------------
>
>                 Key: AMBARI-9016
>                 URL: https://issues.apache.org/jira/browse/AMBARI-9016
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-server
>    Affects Versions: 1.7.0
>            Reporter: Sean Roberts
>            Priority: Minor
>              Labels: newbie
>
> The blueprints API, when taking & responding with json, is only accepting Content-Type:application/x-www-form-urlencode
and responds with Content-Type:text/plain.
> For example, the 1st block below sends the json as application/json but fails. While
the 2nd block sends  "application/x-www-form-urlencoded" and succeeds. Also note that the
2nd response comes back as "text/plain" even though the data is json.
> {code}
> $ cat temp.json | ambari_httpie -vvv POST $ambari_api/stacks/HDP/versions/2.2/recommendations
> POST /api/v1/stacks/HDP/versions/2.2/recommendations HTTP/1.1
> Accept: application/json
> Accept-Encoding: gzip, deflate
> Authorization: Basic YWRtaW46YWRtaW4=
> Content-Length: 187
> Content-Type: application/json; charset=utf-8
> Cookie: AMBARISESSIONID=17qljv0e8tnn83fk6fyc7qkt2
> Host: localhost:8080
> User-Agent: HTTPie/0.8.0
> X-Requested-By: ambari
> {
>     "hosts": [
>         "sandbox.hortonworks.com"
>     ],
>     "recommend": "configurations",
>     "services": [
>         "HDFS",
>         "MAPREDUCE2",
>         "TEZ",
>         "YARN"
>     ]
> }
> HTTP/1.1 406 Not Acceptable
> Content-Length: 50
> Content-Type: text/plain;charset=ISO-8859-1
> Server: Jetty(7.6.7.v20120910)
> {
>   "status": 406,
>   "message": "Not Acceptable"
> }
> {code}
> {code}
> $ cat temp.json | ambari_httpie -vvv -f POST ${ambari_api}/stacks/HDP/versions/2.2/recommendations
> POST /api/v1/stacks/HDP/versions/2.2/recommendations HTTP/1.1
> Accept: */*
> Accept-Encoding: gzip, deflate
> Authorization: Basic YWRtaW46YWRtaW4=
> Content-Length: 187
> Content-Type: application/x-www-form-urlencoded; charset=utf-8
> Cookie: AMBARISESSIONID=17qljv0e8tnn83fk6fyc7qkt2
> Host: localhost:8080
> User-Agent: HTTPie/0.8.0
> X-Requested-By: ambari
> {
>     "hosts": [
>         "sandbox.hortonworks.com"
>     ],
>     "recommend": "configurations",
>     "services": [
>         "HDFS",
>         "MAPREDUCE2",
>         "TEZ",
>         "YARN"
>     ]
> }
> HTTP/1.1 200 OK
> Content-Length: 1768
> Content-Type: text/plain
> Server: Jetty(7.6.7.v20120910)
> {
>   "resources" : "SNIPPED-REST-OF-RESPONSE"
> }
> {code}
> (This is my 1st bug report. Tell me how to be make it better).
> -- 
> Sean Roberts
> @seano



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message