This repository has been archived by the owner on Jan 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
199 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,85 @@ | ||
REST API | ||
======== | ||
|
||
These are the REST endpoints available to MozTrap. | ||
These are the REST endpoints available to MozTrap. These are build using the | ||
`TastyPie`_ package, so please also refer to the TastyPie documentation for more | ||
info. | ||
|
||
.. _TastyPie: http://django-tastypie.readthedocs.org/en/latest/resources.html | ||
|
||
General | ||
------- | ||
|
||
The general format for all rest endpoints is: | ||
|
||
.. http:get:: /api/v1/<object_type>/ | ||
Return a list of objects | ||
|
||
**Example request**: | ||
|
||
.. sourcecode:: http | ||
|
||
GET /api/v1/product/?format=json&limit=50 | ||
|
||
.. http:get:: /api/v1/<object_type/<id>/ | ||
Return a single object | ||
|
||
.. http:post:: /api/v1/<object_type>/ | ||
Create one or more items. **requires** :ref:`API key<api-key>` | ||
|
||
.. http:put:: /api/v1/<object_type>/<id> | ||
Update one item. **requires** :ref:`API key<api-key>` | ||
|
||
.. http:delete:: /api/v1/<object_type>/<id> | ||
Delete one item. **requires** :ref:`API key<api-key>` | ||
|
||
.. note:: | ||
|
||
* POST does not replace the whole list of items, it only creates new ones | ||
* DELETE on a list is not supported | ||
* PUT to a list is not supported | ||
|
||
|
||
Query Parameters | ||
---------------- | ||
|
||
* See each individual :ref:`Object Types<object-types>` for the params it | ||
supports. | ||
* See `TastyPie Filtering`_ for more info on query parameters. | ||
|
||
.. _TastyPie Filtering: http://django-tastypie.readthedocs.org/en/latest/resources.html#basic-filtering | ||
|
||
|
||
Some fields are universal to all requests and :ref:`Object Types<object-types>`: | ||
|
||
* **format** (required) The API **always** requires a value of ``json`` for | ||
this field. | ||
* **limit** (optional) Defaults to 20 items, but can be set higher or lower. | ||
0 will return all records. | ||
|
||
|
||
.. note:: | ||
|
||
The underscores in query param fields (like ``case__suites``) are **DOUBLE** | ||
underscores. | ||
|
||
|
||
.. _object-types: | ||
|
||
Supported Object Types | ||
---------------------- | ||
|
||
.. toctree:: | ||
:maxdepth: 3 | ||
:maxdepth: 2 | ||
|
||
core | ||
library | ||
execution | ||
environments | ||
tags | ||
key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.. _api-key: | ||
|
||
API Keys | ||
======== | ||
|
||
API Keys are generated on the ``Manage | Users`` page for a user. Only an | ||
:ref:`Admin<admin-role>` can create an API Key for a user. | ||
|
||
The API key is passed on the query string for an API like this:: | ||
|
||
``POST /api/v1/product?username=camd&api_key=abc123`` | ||
|
Oops, something went wrong.