CloudServices/WheresMyFox: Difference between revisions

Line 155: Line 155:


=== Device Commands ===
=== Device Commands ===
One or more of the following commands may be issued in a single server response:


<table border=0 cellpadding=15 cellspacing=0>
<table border=0 cellpadding=15 cellspacing=0>
<tr>
<tr bgcolor="aaaaaa">
<th valign=top>Command</th><th valign=top>Short Code</th><th valign=top>Additional parameters</th><th valign=top>Details</th>
<th valign=top>Command</th><th valign=top>Short Code</th><th valign=top>Additional parameters</th><th valign=top>Details</th>
</tr>
</tr>
Line 163: Line 165:
   <td>lock</td><td>l</td><td>"c": <lock code></td><td>Specify the lock code to use, if no device lock code is present. If a lock code already exists on the device, lock the device with the  
   <td>lock</td><td>l</td><td>"c": <lock code></td><td>Specify the lock code to use, if no device lock code is present. If a lock code already exists on the device, lock the device with the  
device's lock code.</td>
device's lock code.</td>
</tr>
<tr bgcolor="eeeee">
  <td>message</td><td>m</td><td>"m": <message><br>"n": <phone number></td><td>Displays <message> on the device including the contact <phone number>. Contact numbers are limited to 25 characters in the set <code>0123456789 +-()</code>. Messages are limited to 100 standard (non-control) ASCII characters</td>
</tr>
<tr>
  <td>ring</td><td>r</td><td>"d": <duration><br>"p": <period></td><td>Cause the device to ring every <period> seconds for the specified duration. Specifying a duration of 0 cancels any previous ring commands.</td>
</tr>
<tr bgcolor="eeeee">
  <td>track</td><td>t</td><td>"d": <duration><br>"p": <period></td><td>Begin active location tracking on the device, reporting the devices position every <period> seconds for <duration> seconds. See below for the response format for this report. Specifying a duration of 0 stops the device from reporting
its location.</td>
</tr>
<tr>
  <td>erase</td><td>e</td><td></td><td>Erase the device. This performs a factory reset.</td>
</tr>
</tr>
</table>
</table>
<b>Commands</b> consist of a JSON object containing zero or more of the following:
    {"<i>command</i>": {<i>arguments</i>},... }
<dl>
<dt><b>l</b>ock
<dd>Specify the lock <b>c</b>ode to use, if no device lock code is present.
If a lock code already exists on the device, lock the device with the
device's lock code.<br>
Example:<br>
    {"l":{"c":1234}}
<dt><b>r</b>ing
<dd>Cause the device to ring every <b>p</b>eriod seconds for a
<b>d</b>uration of seconds. Specifying a duration of "0" stops the device
from ringing.<br>
Example:<br>
    {"r":{"p":10,"d":60}}
<dt><b>m</b>essage
<dd>Display a message on the device consisting of a contact <b>n</b>umber
and text <b>m</b>essage. <br>
contact numbers may only consist of the following: <code>0123456789 +-()</code>,
and is limited to 25 characters.<br>
message text may only be 100 or less standard ASCII, non-control
characters.<br>
Example:<br>
    {"m":{"n":"+1 (408) 555-555", "m":"Help, I'm lost. Please return me!"}}
<dt><b>t</b>rack
<dd>Begin active location tracking on the device, reporting the devices
position every <b>p</b>eriod second for a <b>d</b>uration of seconds.
See POST /$v/cmd/$deviceUniqueId for how the device reports this
information. Specifying a duration of 0 stops the device from reporting
its location.<br>
Example:<br>
    {"t":{"p":10,"d":300}}
<dt><b>e</b>rase
<dd>Erase the device. This performs a factory reset.<br>
Example:<br>
    {"e":{}}
</dl>
Any of the above commands may be combined into a single command. For
example, to lock a phone, display a message with contact number and cause
the device to ring ever 30 seconds for 5 minutes:
    {"l":{"c":1111},
    "m":{"n":"555-555-5555","m":"Please return me!"},
    "r":{"p":30,"d":300}}
Responses contain a hash of one or more device commands keyed to a hash with information about that particular command.


A successful client response will be formatted:
A successful client response will be formatted:
Line 233: Line 196:


Other HTTP response codes (500, 301, 200, etc) perform as per normal.
Other HTTP response codes (500, 301, 200, etc) perform as per normal.
<b>Replies for the "l", "r", "m", or "e" command:</b><br>
the device shall return an object containing a "status" and optionally an
"error" string.<br>
For example, a successful lock and ring would return:
    {"l":{"ok":true},"r":{"ok":true}}
In the case of an error with the ringer:
    {"l":{"ok":true},"r":{"ok":false,"error":"no ringtone found"}}


<b>For the "t" command:</b><br>
<b>For the "t" command:</b><br>
Line 253: Line 208:
for whatever reason, the user has not activated or authorized geo-location for
for whatever reason, the user has not activated or authorized geo-location for
a device, the "la"/"lo" values may be specified as 0.
a device, the "la"/"lo" values may be specified as 0.
The body of the POST reply shall optionally contain further commands from the
server. The following section describes these commands.


==Platform Requirements==
==Platform Requirements==
canmove, Confirmed users
1,173

edits