com.sun.jersey.api.MessageException when using Http::DELETE method

I have been using the SketchUp Http module for a few time, and honestly it works very nice, but recently I have found an issue that I am not able to fix.

I’m trying to send a DELETE request to a server using its RESTful API. The code is something like:

url = 'https://myUrl/myApi'
headers = { 'Authorization' => myToken, 'Content-Type' => 'application/json' }
payload = [{ 'id' => myId1, 'details' => myDetails1 }, { 'id' => myId2, 'details' => myDetails2} ]

request =, Sketchup::Http::DELETE)
request.headers = headers
request.body = payload.to_s

request.start do |req, res|
  status = res.status_code
  body = JSON.parse(res.body)
  if status == 204
      # Do whatever
      UI.messagebox('Error ' + status.to_s)

I’m getting a HTTP 400 Bad Request and an errorcode: INVALID_OPERATION in the response body, with the following message:

“message” : "com.sun.jersey.api.MessageException: A message body reader for Java class java.util.List, and Java type java.util.List<com.gehrytech.gteam.core.common.dto.ObjectDto>, and MIME media type application/octet-stream was not found. The registered message body readers compatible with the MIME media type are:\napplication/octet-stream → com.sun.jersey.core.impl.provider.entity.ByteArrayProvider…

And a list of compatible body readers.

I did some tests:

  • I tried the same call with Postman and it’s working

  • If I use POST or GET as methods in the same request, the response status is a HTTP 200 OK.

  • I tried DELETE with a different API request with no payload, and the response is correct (HTTP 204).

  • I tried a different API request that uses POST, but has the same payload (array of hashes), and the response is correct (HTTP 200).

So I guess the issue comes when having an array in the payload (java.util.List) and using the method DELETE.

Any hint? I tried to migrate this specific request to Net/Http but sometimes is taking ages to get the response, so it’s not really efficient.

com.sun.jersey is a RESTful web service framework for Java. SketchUp does not include Java, the error occurs not on client-side, but on the server.

It must be specific to the URL to which you send the request.

  • If you have access to the web service, check its logs.
  • If not:
    • check the documentation whether you use the REST API correctly. Do you send the correct MIME-type? Try an example REST call that should work.
    • contact the administrator of the web service or provider of the API

Your “Content-Type” is set to JSON, but you are not creating a JSON string with Array#to_s.

Try …

request.body = payload.to_json

@DanRathbun still get the same error. Actually with Array#to_s is working well with the rest of calls I tried.

@Aerilius I did contacted them, and waiting for response.

The weird thing is the same call is working in Postman, so they will probably tell me the problem is on the code.

But using the same code, and just changing

request =, Sketchup::Http::DELETE)


request =, Sketchup::Http::POST)
request =, Sketchup::Http::GET)

returns a status HTTP 200, and not a HTTP 400. So it seems the code is ok too.