{"action":"closed","issue":{"url":"https://api.github.com/repos/ibm-watson-iot/iot-java/issues/37","repository_url":"https://api.github.com/repos/ibm-watson-iot/iot-java","labels_url":"https://api.github.com/repos/ibm-watson-iot/iot-java/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/ibm-watson-iot/iot-java/issues/37/comments","events_url":"https://api.github.com/repos/ibm-watson-iot/iot-java/issues/37/events","html_url":"https://github.com/ibm-watson-iot/iot-java/issues/37","id":165794167,"number":37,"title":"Not able to register new device","user":{"login":"NitishDeshpande","id":7845698,"avatar_url":"https://avatars.githubusercontent.com/u/7845698?v=3","gravatar_id":"","url":"https://api.github.com/users/NitishDeshpande","html_url":"https://github.com/NitishDeshpande","followers_url":"https://api.github.com/users/NitishDeshpande/followers","following_url":"https://api.github.com/users/NitishDeshpande/following{/other_user}","gists_url":"https://api.github.com/users/NitishDeshpande/gists{/gist_id}","starred_url":"https://api.github.com/users/NitishDeshpande/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NitishDeshpande/subscriptions","organizations_url":"https://api.github.com/users/NitishDeshpande/orgs","repos_url":"https://api.github.com/users/NitishDeshpande/repos","events_url":"https://api.github.com/users/NitishDeshpande/events{/privacy}","received_events_url":"https://api.github.com/users/NitishDeshpande/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-07-15T14:05:38Z","updated_at":"2016-07-18T12:04:05Z","closed_at":"2016-07-18T12:04:05Z","body":"I am trying to register a device to IoT Platform using the java client library. Here is my code,\r\n\r\n```\r\n\t\t\ttry {\r\n\t\t\t\tclient.connect();\t\t\t\t\r\n\t\t\t\tJsonObject deviceInfo = new JsonObject();\r\n\t\t\t\tdeviceInfo.addProperty(\"manufacturer\", \"Philips\");\r\n\t\t\t\tdeviceInfo.addProperty(\"model\", \"m001\");\r\n\t\t\t\t\r\n\t\t\t\tJsonObject location = new JsonObject();\r\n\t\t\t\tdeviceInfo.addProperty(\"longitude\", 8.107910);\r\n\t\t\t\tdeviceInfo.addProperty(\"latitude\", 8.525342);\r\n\t\t\t\tdeviceInfo.addProperty(\"elevation\", 0);\r\n\t\t\t\tdeviceInfo.addProperty(\"accuracy\", 0);\r\n\t\t\t\tdeviceInfo.addProperty(\"measuredDateTime\", \"2016-07-15T12:21:50.879Z\");\r\n\t\t\t\t\r\n\t\t\t\tJsonObject metadata = new JsonObject();\r\n\t\t\t\tdeviceInfo.addProperty(\"manufacturer\", \"Philips\");\r\n\t\t\t\tdeviceInfo.addProperty(\"model\", \"m001\");\r\n\t\t\t\t\r\n\t\t\t\tclient.api().registerDevice(\"LightBulb\", \"LB002\", \"&wR+6LHX_QcxwXz4Po\", deviceInfo, location, metadata);\r\n\t\t\t\t\r\n\t\t\t} catch (MqttException | IoTFCReSTException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t\treturn;\r\n\t\t\t} finally {\r\n\t\t\t\tSystem.out.println(\"Closing connection to the IBM Watson IoT Platform\");\r\n\t\t\t\t// Once told to stop, cleanly disconnect from the service\r\n\t\t\t\tclient.disconnect();\r\n\t\t\t}\r\n```\r\n\r\nOn running this code I am getting a **IoTFCReSTException** saying,\r\n\r\n```\r\n2016-07-15 19:30:16.221  INFO 10236 --- [nio-8080-exec-1] com.ibm.iotf.util.LoggerUtility          : http-nio-8080-exec-1: Successfully connected to the IBM Watson IoT Platform\r\n\r\ncom.ibm.iotf.client.IoTFCReSTException: Invalid request (No body, invalid JSON, unexpected key, bad value)\r\n\tat com.ibm.iotf.client.api.APIClient.registerDevice(APIClient.java:1723)\r\n\tat com.ibm.iotf.client.api.APIClient.registerDevice(APIClient.java:1666)\r\n\tat com.mindtree.coe.iot.watson.services.AssetsService.addInternetCapableAsset(AssetsService.java:66)\r\n\tat com.mindtree.coe.iot.watson.controllers.AssetsController.addNewAsset(AssetsController.java:26)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n// ... more exception stack trace\r\n\r\n2016-07-15 19:30:17.980  INFO 10236 --- [nio-8080-exec-1] com.ibm.iotf.util.LoggerUtility          : http-nio-8080-exec-1: Successfully disconnected from from the IBM Watson IoT Platform\r\n```\r\n\r\nWhat could possibly the issue?\r\n\r\nP.S. - There is a device type called **LightBulb** created in the platform. Manual creation of the device in the IoT platform through the browser works perfectly"}}
{"actor":{"display_login":"whitfiea"}}