POST to Remote Web Webservice

Hi,

My dropwizard server cant parse any json sent by DF(2.1)
I dont know what is wrong with this call… Sending the same data using Postman, works like a charm.

var options = {
  "CURLOPT_HTTPHEADER": [
      "Content-Type: application/json",
      "Cache-Control: no-cache"]
};
var payload = {
    "deviceId": "d7d8ede787de78d7"
};

result = platform.api.post("http://localhost:8080/v1/registry", payload, options);

Dropwizard log:

INFO [2016-03-31 22:13:30,273] org.glassfish.jersey.filter.LoggingFilter: * Server has received a request on thread dw-109 - POST /v1/registry
> POST http://localhost:8080/v1/registry
> Accept: /
> Cache-Control: no-cache
> Content-Length: 167
> Content-Type: application/json; boundary=------------------------5f051e39590c891b
> Expect: 100-continue
> Host: localhost:8080
--------------------------5f051e39590c891b
Content-Disposition: form-data; name=“deviceId”
d7d8ede787de78d7
--------------------------5f051e39590c891b–
DEBUG [2016-03-31 22:13:30,276] io.dropwizard.jersey.jackson.JsonProcessingExceptionMapper: Unable to process JSON
! com.fasterxml.jackson.core.JsonParseException: Unexpected character (‘-’ (code 45)) in numeric value: expected digit (0-9) to follow minus sign, for valid numeric value
! at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@41562f6a; line: 1, column: 3]

Any help will be appreciated.
Thanks!

Not sure though but can you try passing the payload this way

var payload = { 
"resource": [
     { 
        "deviceId": "d7d8ede787de78d7"
     }
  ] 
};

@m_menon, I tried your suggestion, but didnt work.

The trick in this case is use JSON.stringify(payload)… without resource.