User:LesOrchard/BandwagonAPI: Difference between revisions

Filled out authen section
(more progress - need to flesh out representations)
(Filled out authen section)
Line 32: Line 32:


==== AMOv3 cookie session ID ====
==== AMOv3 cookie session ID ====
If a <tt>Cookie:</tt> header is sent with the value of an <tt>AMOv3</tt>
login session ID, that value will be validated first in authenticating the user.
Example header, with the <tt>AMOv3</tt> cookie among other cookies:
    Cookie: foo=bar; AMOv3=865ikpjmn6bqh897msr3o5hv12; baz=quux


==== HTTP basic auth with email/pass ====
==== HTTP basic auth with email/pass ====
If no <tt>AMOv3</tt> cookie header is found, or if it is invalid, an attempt to
authenticate the user with HTTP basic auth will be made.  The username is
expected to be an email address registered with AMO and the correct
password for that account must be supplied.


=== Authorization ===
=== Authorization ===
Line 74: Line 86:
==== /api/sharing/ ====
==== /api/sharing/ ====


This is the main entry point URL for the API.  Examples might look something
This is the main entry point URL for the API.  Concrete examples of this URL
like the following:
might look something like the following:


     http://localhost/~lorchard/addons/api/sharing
     http://localhost/~lorchard/addons/api.php?action=service_doc
     http://dev.addons.mozilla.com/en-US/firefox/api/1.3/sharing
     http://dev.addons.mozilla.com/en-US/firefox/api/1.3/sharing
     https://preview.addons.mozilla.org/en-US/firefox/api/1.3/sharing
     https://preview.addons.mozilla.org/en-US/firefox/api/1.3/sharing
Line 94: Line 106:
==== /api/sharing/collections/ ====
==== /api/sharing/collections/ ====


This resource represents the set of all collections shared.
This resource represents the set of all shared collections.


===== POST - Create a new collection =====
===== POST - Create a new collection =====
Line 107: Line 119:
** Status: <tt>201 Created</tt>
** Status: <tt>201 Created</tt>
** Content-Type: [[#Addon Collection]]
** Content-Type: [[#Addon Collection]]
** Response body will contain collection details, but no addons.
** Response body will contain the details of the new collection, but will be empty of addons.
** Location header points to the URL of new collection.
** Location header points to the URL of new collection.
*** i.e. <tt>Location: /api/1.3/sharing/collections/5497c4b6-f2e9-11dd-b326-7f8fd4293122</tt>
*** i.e. <tt>Location: /api/1.3/sharing/collections/5497c4b6-f2e9-11dd-b326-7f8fd4293122</tt>
Line 127: Line 139:
** Parameters:
** Parameters:
*** <tt>guid</tt> - GUID of addon to add to list
*** <tt>guid</tt> - GUID of addon to add to list
*** <tt>notes</tt> - human readable notes about the addon
*** <tt>notes</tt> - (optional) human readable notes about the addon


* Response (on success)  
* Response (on success)  
Line 150: Line 162:
** Status: <tt>200 OK</tt>
** Status: <tt>200 OK</tt>
** Content-Type: [[#Addon Collection]]
** Content-Type: [[#Addon Collection]]
<!-- not implemented? not needed?


===== PUT - Update details on an addon in a collection =====
===== PUT - Update details on an addon in a collection =====
Line 163: Line 177:
** Content-Type: empty body
** Content-Type: empty body
** Status: <tt>202 Accepted</tt>
** Status: <tt>202 Accepted</tt>
-->


===== DELETE - Remove an addon from a collection =====
===== DELETE - Remove an addon from a collection =====
Confirmed users
920

edits