Closed craigmulligan closed 8 years ago
I agree. We have it in the queue. This is how I see it on the long term:
Anyway, you, as the API user, should NOT support the streams and the empty ID.
You still need to pass an id attribute and an streams array.
I was not overriding the old "POST /devices" , but created a new under "POST /devices/register". We can deprecate the old one, as I think it is not useful and no one is using it anymore, and change "POST /devices" it to the new syntax.
Oh I see, could you clarify what exactly needs to be posted? When I post the following to /devices/register
as per the swagger example.
{
"name": "C2650 SensorTag",
"protocol": "iot.agile.protocol.BLE",
"id": "B0:B4:48:BD:10:85",
"status": "CONNECTED"
}
It returns an 400 err:
Unrecognized field "name" (class iot.agile.http.resource.DeviceManager$RegisterArgs), not marked as ignorable (2 known properties: "overview", "type"])
at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@17aaa47; line: 6, column: 2] (through reference chain: iot.agile.http.resource.RegisterArgs["name"])
My bad, I still struggle with getting the right syntax out of swagger. What you need is: { "overview": { "name": "C2650 SensorTag", "protocol": "iot.agile.protocol.BLE", "id": "B0:B4:48:BD:10:85", "status": "CONNECTED" } "type": "TI SensorTag" }
The value of type you are supposed to get from /api/devices/typof to which you first pass the overview. This returns an array of possible types. If there is only one, you can use that, if there are more, someone should decide which implementation to use.
I think I'm missing a "," above
{ "overview": { "name": "C2650 SensorTag", "protocol": "iot.agile.protocol.BLE", "id": "B0:B4:48:BD:10:85", "status": "CONNECTED" }, "type": "TI SensorTag" }
Ah thanks, Could you elaborate on the /api/devices/typof
call, there aren't any docs.
What is the type
used for?
argh. typo. /api/devices/typeof This is the device type. When you register a device, you should be able to tell what it is, since it cannot always be autodetected. The workflow is:
I tried typeof
too but still failing - see issue #35
The swagger documented version is working now. See: http://petstore.swagger.io/?url=http://agile-iot.github.io/agile-api-spec/docs/swagger/api.swagger.yml#!/DeviceManager/TypeOf http://petstore.swagger.io/?url=http://agile-iot.github.io/agile-api-spec/docs/swagger/api.swagger.yml#!/DeviceManager/Register
Note that:
DeviceOverview
and type
to /devices. /devices/register still works, but it is deprecated.
If I query all devices via
/api/protocols/devices
it returns an object like this:
However it appears to register a device a stream object needs to present. Eg. this doesn't work:
In my opinion, you should be able to post back an unregistered device object recieved from
/api/protocols/devices
but the current registration endpoint requires other attributes like address and a blankdeviceId
instead ofid
.Thoughts?