API PUT using http-client having issue

Homepage Clovertech Forums Cloverleaf API PUT using http-client having issue

  • Creator
    Topic
  • #121431
    Pete
    Participant

    Version: 6.1.1.0P

    I am trying to send a basic JSON test message using an API PUT and am getting the following in the logging. I can see that I am making the connection and uploading the data. Then I see the HTTP/1.1 415 Unsupported Media Type.  I have the content type in the Headers section of the HTTP Options tab.  Am I missing something or have something formatted incorrectly?

    [pd :thrd:DBUG/3:sc08angleye_o:–/–/—- –:–:–] message : ‘[{“first”:”MBCONE”,”middle”:””,”last”:”APPTESTBLDBNK”,”mrn”:”200078157″,”dob”:”02/07/1982″,”bed_id”:”MBC M6 EAST-MBC655-MBC655B”,”encounter_id”:”2000489712″}]\x0d’
    [msg :Msg :DBUG/0:sc08angleye_o:05/29/2024 15:57:33] msgFree 0x0xf6368b28 refCnt 1
    [pd :pdtd:INFO/0:sc08angleye_o:05/29/2024 15:57:33] [0.0.76076205] Writing message to Protocol Driver http-client
    [tps :tps :INFO/1:sc08angleye_o:05/29/2024 15:57:33] tds.string = AngelEyehttpQuery {MSGID message0} {CONTEXT httpc_query} {ARGS {{MSGUSE DATA}}} {MODE run} {VERSION 3.0}
    [tcl :out :INFO/0:sc08angleye_o:05/29/2024 15:57:33] Executing: httpput {URL https://clinical-api.staging.angeleyehealth.com/HL7/v1/adt/update} {METHOD PUT} {HEADERS {{Content-Type: application/json; charset=utf-8}}} {OBRESEND 1} {REPLYGEN {
    [tcl :out :INFO/0:sc08angleye_o:–/–/—- –:–:–] { TYPE none }
    [tcl :out :INFO/0:sc08angleye_o:–/–/—- –:–:–] }} {TIMEOUT -1} {WAIT 0} {NO_CURL 0} {DEBUG 1} {DATA {[{“first”:”MBCONE”,”middle”:””,”last”:”APPTESTBLDBNK”,”mrn”:”200078157″,”dob”:”02/07/1982″,”bed_id”:”MBC M6 EAST-MBC655-MBC655B”,”encounter_id”:”2000489712″}] }}
    [tcl :out :INFO/0:sc08angleye_o:05/29/2024 15:57:33]
    [http:tps :DBUG/3:sc08angleye_o:05/29/2024 15:57:33] httpPUT:timeout=-1, connTimeout=-1,noCurl=0
    [http:open:DBUG/3:sc08angleye_o:05/29/2024 15:57:33] letCurlDoIt: method = 1, url=https://clinical-api.staging.angeleyehealth.com/HL7/v1/adt/update
    * Hostname was NOT found in DNS cache
    * Trying 34.196.109.6…
    * Connected to clinical-api.staging.angeleyehealth.com (34.196.109.6) port 443 (#0)
    * successfully set certificate verify locations:
    * CAfile: /etc/pki/tls/certs/ca-bundle.crt
    CApath: none
    * SSL connection using TLSv1.0 / ECDHE-RSA-AES128-SHA
    * Server certificate:
    * subject: CN=*.staging.angeleyehealth.com
    * start date: 2023-11-28 00:00:00 GMT
    * expire date: 2024-12-26 23:59:59 GMT
    * subjectAltName: clinical-api.staging.angeleyehealth.com matched
    * issuer: C=US; O=Amazon; CN=Amazon RSA 2048 M03
    * SSL certificate verify ok.
    > PUT /HL7/v1/adt/update HTTP/1.1
    User-Agent: Quovadx CISAgent
    Host: clinical-api.staging.angeleyehealth.com
    Accept: */*
    From: anonymous@unknown.com
    Connection: close
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 159
    Expect: 100-continue

    < HTTP/1.1 100 Continue
    [http:read:DBUG/3:sc08angleye_o:05/29/2024 15:57:34] Got response code: 100 from HTTP server
    [http:wrte:DBUG/3:sc08angleye_o:05/29/2024 15:57:34] httpPUT/POST: send 159 bytes to server
    * We are completely uploaded and fine
    < HTTP/1.1 415 Unsupported Media Type
    < Date: Wed, 29 May 2024 20:57:34 GMT
    < Content-Type: application/json; charset=utf-8
    < Transfer-Encoding: chunked
    [http:read:DBUG/3:sc08angleye_o:05/29/2024 15:57:34] Got Transfer-Encoding: chunked
    < Connection: close

Viewing 5 reply threads
  • Author
    Replies
    • #121432
      Jim Kosloskey
      Participant

      Are you sure the server can process json content with utf-8 character set?

      Looking this 415 code up, it indicates the server cannot process the indicated payload type.

      email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

    • #121434
      Pete
      Participant

      That is the format that was requested. Looking at the log it seems like I am setting that (json content with utf-8) in the HEADERS but when it actually transfers it is showing application/x-www-form-urlencoded:

      PUT /HL7/v1/adt/update HTTP/1.1
      User-Agent: Quovadx CISAgent
      Host: clinical-api.staging.angeleyehealth.com
      Accept: */*
      From: anonymous@unknown.com
      Connection: close
      Content-Type: application/x-www-form-urlencoded
      Content-Length: 159
      Expect: 100-continue

      I am thinking this response means they are expecting json with UTF-8 but are getting something different. Unless I am reading that log incorrectly.

       

      < HTTP/1.1 100 Continue
      [http:read:DBUG/3:sc08angleye_o:05/29/2024 15:57:34] Got response code: 100 from HTTP server
      [http:wrte:DBUG/3:sc08angleye_o:05/29/2024 15:57:34] httpPUT/POST: send 159 bytes to server
      * We are completely uploaded and fine
      < HTTP/1.1 415 Unsupported Media Type
      < Date: Wed, 29 May 2024 20:57:34 GMT
      < Content-Type: application/json; charset=utf-8
      < Transfer-Encoding: chunked
      [http:read:DBUG/3:sc08angleye_o:05/29/2024 15:57:34] Got Transfer-Encoding: chunked
      < Connection: close

    • #121435
      Robert Kersemakers
      Participant

      Is this your json?

      [{“first”:”MBCONE”,”middle”:””,”last”:”APPTESTBLDBNK”,”mrn”:”200078157″,”dob”:”02/07/1982″,”bed_id”:”MBC M6 EAST-MBC655-MBC655B”,”encounter_id”:”2000489712″}]

      I put this json through an online validator and it looks like all these double quotes are not double quotes at all. I call these the Word-quotes or Word-punctuation marks. Can you try to replace all Word double quotes like “ and ” with normal double quotes ” ?

      Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

    • #121436
      Robert Kersemakers
      Participant

      I hope these double quotes aren’t caused by this forum…

      Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

      • #121438
        Pete
        Participant

        Looks like it is just from copying and pasting from the forum. I tried both ways and my message works, when I copy from the forum here I see the same errors you mention.

    • #121437
      Pete
      Participant

      I’ll double check that.

    • #121439
      Robert Kersemakers
      Participant

      This link has some useful things to check. https://stackoverflow.com/questions/22566433/http-415-unsupported-media-type-error-with-json

      • Change Content-Type: application/json; charset=utf-8
        into Content-Type: application/json;charset=utf-8
        so without the space before charset.
      • Change Content-Type: application/json; charset=utf-8
        into Content-Type: application/json
        so no charset at all
      • You get a different Accept content-type than the content-type you send. You can define the Accept content-type by adding header “Accept: application/json”.

      Hope this helps.

      Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

Viewing 5 reply threads
  • You must be logged in to reply to this topic.

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,432
Topic Tags
286
Empty Topic Tags
10