Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FxOS Device Service API

21 views
Skip to first unread message

Sam Giles

unread,
Nov 26, 2015, 11:36:04 AM11/26/15
to dev-fxos
Hey

I was taking a look at the fxos-device-service to see if I could easily add B2GDroid support and thought the method of requesting a command to apply to a specific device was odd.

The API has the concept of `/devices` which will give you a collection of the attached devices identified by their adb ids.  You can then get a particular device by getting `/devices/:id`.

Following that, the other commands don't seem to relate to the adb device id - and I just spotted: unless you use a header.

Wouldn't using the device ID in the URL give us more transparent URLs by basing the URLs on the resources and related actions the consumer wants to perform?

For example:

POST /devices/:id/restart
GET /devices/:id/logs
GET /devices/:id/properties
etc.

Sam

Eli Perelman

unread,
Nov 26, 2015, 11:45:10 AM11/26/15
to Sam Giles, dev-fxos
Hey Sam,

That was a conscious decision we made because referring to a particular device could be more than just a serial number, it could also need a remote host and port.

The other option would be to make :id a reference to a device not directly by serial number. Right now we store a reference to a device session via a hash which is returned via a response header, we could potentially make that session identifier the ID used in the URL, and then the other methods could map to that interface.

I will agree with you that your proposal is more RESTy. Feel free to file a bug and I'll look into it. 

Thanks!

Eli Perelman

Eli Perelman

unread,
Dec 2, 2015, 1:59:34 PM12/2/15
to Sam Giles, dev-fxos
Closing the loop on this, I just landed [1] a change to the device service so the need for headers is gone, and all the routes are contextual to a device selected in /devices, per Sam's request.

Thanks Sam!

Eli Perelman

Sam Giles

unread,
Dec 3, 2015, 8:57:09 AM12/3/15
to Eli Perelman, dev-fxos
Thanks! It's great to see this land in less than a week!

Sam
0 new messages