As raised on the mailing list , the device selection API and subsequent requests can be weird when expecting a truer REST-like interface. For instance, when querying for /logs, it would make sense to make that contextual to the device selection already done via /devices/:id. In order to make this happen, a request to /devices should return an identifier to a device which is currently a combination of serial number, remote host, and remote port. This ID can then be used to scope device-specific requests, e.g. /devices/:id/logs. I'm even finding having this mechanism in Raptor would be more useful than how it's currently being used.  https://groups.google.com/d/msg/mozilla.dev.fxos/WqknNHBCh6I/k-a3PydDAQAJ
Trying to keep more true to REST, we should also remove /device in favor of /devices/:id.
Created attachment 8693852 [details] [review] Link to Github pull-request: https://github.com/mozilla-b2g/fxos-device-service/pull/32 This PR moves all device-specific APIs under /devices/:id. ID is no longer a device serial, but rather an identifier representing the aggregation of a serial, remote host, and remote port. This is synonymous with the Session-Id header that was previously generated. No more need for headers like X-Android-Serial, etc. By querying for /devices first, then getting an identifier for one, you can use the "session id"/device id to execute subsequent requests. I believe this cleans up making requests, since always having to add that header was kind of a pain. To get the devices for a remote host/port, add query string parameters: GET /devices?host=localhost&port=2828 You'll get back an array of devices which have serials, remote hosts, remote ports, and the device id. Most of the use cases I can think of will only have need of the device id. If there's any questions about this change, please let me know. :)
Comment on attachment 8693852 [details] [review] Link to Github pull-request: https://github.com/mozilla-b2g/fxos-device-service/pull/32 Nice! This looks much easier to work with, Thanks :)
Attachment #8693852 - Flags: feedback?(sgiles) → feedback+
Comment on attachment 8693852 [details] [review] Link to Github pull-request: https://github.com/mozilla-b2g/fxos-device-service/pull/32 I am super happy with this! r=me
Attachment #8693852 - Flags: review?(gaye) → review+
Excellent! In master: https://github.com/mozilla-b2g/fxos-device-service/commit/9cdc65b5e3aae0d15051272e9b092ea21be15ff1 In npm: email@example.com
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.