Labs/Weave/ServerAPI: Difference between revisions

Added documentation on the sharing API.
No edit summary
(Added documentation on the sharing API.)
Line 117: Line 117:
   </tr>
   </tr>
</table>
</table>
== The Sharing API ==
The sharing API allows the owning user of a folder to share it with other users, allowing them read-only access to it.  Simply make a POST request to https://sm-labs01.mozilla.org:81/api/share/ and provide the following parameters:
'''uid, password, cmd'''
<tt>uid</tt> and <tt>password</tt> are the username and password of the user making the share request.  <tt>cmd</tt> is a JSON object containing the following keys:
* <tt>version</tt> - This must be 1.
* <tt>directory</tt> - This is the directory to be shared, relative to the owner's user directory.
* <tt>share_to_users</tt> - This is a list of the users who should be given access to read the directory.  If it is a list with "all" as its only element, then the directory is readable by anyone.
If successful, the response will be HTTP 200 OK with a body text of "OK".  If the response code is different or the body is not "OK", then something has gone amiss.  (Unfortunately, the sharing API wasn't designed with nearly as much attention to detail as the rest of the API; this will be changed in a later release.)
874

edits