Closed
Bug 1229084
Opened 10 years ago
Closed 10 years ago
[fxos-device-service] Contextualize routes based on single device selection
Categories
(Firefox OS Graveyard :: Infrastructure, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
2.6 S2 - 12/4
People
(Reporter: Eli, Assigned: Eli)
Details
(Whiteboard: [systemsfe])
Attachments
(1 file)
As raised on the mailing list [1], 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.
[1] https://groups.google.com/d/msg/mozilla.dev.fxos/WqknNHBCh6I/k-a3PydDAQAJ
| Assignee | ||
Comment 1•10 years ago
|
||
Trying to keep more true to REST, we should also remove /device in favor of /devices/:id.
| Assignee | ||
Comment 2•10 years ago
|
||
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. :)
Attachment #8693852 -
Flags: review?(gaye)
Attachment #8693852 -
Flags: feedback?(sgiles)
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 4•10 years ago
|
||
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+
| Assignee | ||
Comment 5•10 years ago
|
||
Excellent!
In master: https://github.com/mozilla-b2g/fxos-device-service/commit/9cdc65b5e3aae0d15051272e9b092ea21be15ff1
In npm: fxos-device-service@4.0.0
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•