Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-25341

SmartSense API call fails with Unsupported Media Type

    XMLWordPrintableJSON

Details

    Description

      AMBARI-9016 is causing regression in SmartSense by inappropriately changing the Content-Type to "text/plain" for every request with "application/json" Content-Type. This is a proper workaround for the Ambari API but not for SmartSense.

      Calling the SmartSense API failing with :

      HTTP/1.1 415 Unsupported Media Type

       

      curl 'https://172.27.122.133:8443/api/v1/views/SMARTSENSE/versions/1.5.1.2.7.4.0-92/instances/SMARTSENSE_AUTO_INSTANCE/resources/hst/bundles' -H 'Cookie: AMBARISESSIONID=node0mmlb052gnyw31rznh33qguoem22.node0; SUPPORTSESSIONID=1nlk0dmxktunz1bvjr9259adjf' -H 'Origin: https://172.27.122.133:8443' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.9' -H 'X-Requested-By: ambari' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36' -H 'Content-Type: application/json; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: https://172.27.122.133:8443/views/SMARTSENSE/1.5.1.2.7.4.0-92/SMARTSENSE_AUTO_INSTANCE/' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' -H 'withCredentials: true' --data-binary '{"caseNumber":0}' --compressed --insecure -v -u *****
      
      * Trying 172.27.122.133...
      * TCP_NODELAY set
      * Connected to 172.27.122.133 (172.27.122.133) port 8443 (#0)
      * ALPN, offering h2
      * ALPN, offering http/1.1
      * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
      * TLSv1.2 (OUT), TLS handshake, Client hello (1):
      * TLSv1.2 (IN), TLS handshake, Server hello (2):
      * TLSv1.2 (IN), TLS handshake, Certificate (11):
      * TLSv1.2 (IN), TLS handshake, Server key exchange (12):
      * TLSv1.2 (IN), TLS handshake, Server finished (14):
      * TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
      * TLSv1.2 (OUT), TLS change cipher, Client hello (1):
      * TLSv1.2 (OUT), TLS handshake, Finished (20):
      * TLSv1.2 (IN), TLS change cipher, Client hello (1):
      * TLSv1.2 (IN), TLS handshake, Finished (20):
      * SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
      * ALPN, server did not agree to a protocol
      * Server certificate:
      * subject: C=UA; ST=Some-State; O=Internet Widgits Pty Ltd; CN=ctr-e139-1542663976389-172620-01-000002.hwx.site
      * start date: Jul 16 08:42:47 2019 GMT
      * expire date: Jul 15 08:42:47 2020 GMT
      * issuer: C=UA; ST=Some-State; O=Internet Widgits Pty Ltd; CN=ctr-e139-1542663976389-172620-01-000002.hwx.site
      * SSL certificate verify result: self signed certificate (18), continuing anyway.
      * Server auth using Basic with user 'admin'
      > POST /api/v1/views/SMARTSENSE/versions/1.5.1.2.7.4.0-92/instances/SMARTSENSE_AUTO_INSTANCE/resources/hst/bundles HTTP/1.1
      > Host: 172.27.122.133:8443
      > Authorization: Basic YWRtaW46YWRtaW4=
      > Cookie: AMBARISESSIONID=node0mmlb052gnyw31rznh33qguoem22.node0; SUPPORTSESSIONID=1nlk0dmxktunz1bvjr9259adjf
      > Origin: https://172.27.122.133:8443
      > Accept-Encoding: gzip, deflate, br
      > Accept-Language: en-US,en;q=0.9
      > X-Requested-By: ambari
      > User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
      > Content-Type: application/json; charset=UTF-8
      > Accept: application/json, text/javascript, */*; q=0.01
      > Referer: https://172.27.122.133:8443/views/SMARTSENSE/1.5.1.2.7.4.0-92/SMARTSENSE_AUTO_INSTANCE/
      > X-Requested-With: XMLHttpRequest
      > Connection: keep-alive
      > withCredentials: true
      > Content-Length: 16
      >
      * upload completely sent off: 16 out of 16 bytes
      < HTTP/1.1 415 Unsupported Media Type
      < Date: Tue, 16 Jul 2019 18:36:36 GMT
      < Strict-Transport-Security: max-age=31536000
      < X-Frame-Options: SAMEORIGIN
      < X-XSS-Protection: 1; mode=block
      < X-Content-Type-Options: nosniff
      < Cache-Control: no-store
      < Pragma: no-cache
      < Content-Type: application/json;charset=utf-8
      < User: admin
      < X-Content-Type-Options: nosniff
      < Content-Length: 0
      <
      * Connection #0 to host 172.27.122.133 left intact
      

       

      Attachments

        Activity

          People

            payert Tamas Payer
            payert Tamas Payer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m