Search code examples
jsonspringjacksonrdap

406 error occurred. No content to map due to end-of-input error


I request to https://rdap.lacnic.net/rdap/ip/190.42.216.128 to get IP information, but I get a 406 error. That is No content to map due to end-of-input error

In a web browser 200 OK is coming out json data, but when using Spring Resttemplate, 406 error occurs. this is my code using kotlin. Why is that?

 val uri = UriComponentsBuilder
            .fromUriString("https://rdap.lacnic.net/rdap/ip/190.42.216.128")
            .build()

restTemplate.getForEntity(uri.toUriString(), JsonNode::class.java)


Solution

  • The HyperText Transfer Protocol (HTTP) 406 Not Acceptable client error response code indicates that the server cannot produce a response matching the list of acceptable values defined in the request's proactive content negotiation headers, and that the server is unwilling to supply a default representation.

    Ref here.