aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMilo Casagrande <milo.casagrande@linaro.org>2014-08-21 16:55:31 +0200
committerMilo Casagrande <milo.casagrande@linaro.org>2014-08-21 16:55:31 +0200
commit9de4266dded352e932d09841639746f192c073cd (patch)
tree806d20a885daa328b309ec4ce0f84ee0cb767914 /doc
parent1cb72ceb596dc1bc3a408d4fdfaabc0c4a5f31cd (diff)
doc: Added token schema.
Change-Id: I561ddbc3a10f0d3d40c9a21db3384232c41b5e37
Diffstat (limited to 'doc')
-rw-r--r--doc/schema-token.rst96
1 files changed, 96 insertions, 0 deletions
diff --git a/doc/schema-token.rst b/doc/schema-token.rst
new file mode 100644
index 0000000..b009cfc
--- /dev/null
+++ b/doc/schema-token.rst
@@ -0,0 +1,96 @@
+.. _schema_token:
+
+token
+-----
+
+A token object as stored in the database.
+
+::
+
+ {
+ "title": "token",
+ "description": "A token used to interact with the API",
+ "type": "object",
+ "properties": {
+ "_id": {
+ "type": "string",
+ "description": "The ID associated with this object"
+ },
+ "created_on": {
+ "type": "object",
+ "description": "Creation date of the object",
+ "properties": {
+ "$date": {
+ "type": "number",
+ "description": "Milliseconds from epoch time"
+ }
+ }
+ },
+ "token": {
+ "type": "string",
+ "description": "The token that will be used to interact with the API"
+ },
+ "expires_on": {
+ "type": "object",
+ "description": "The date when the token is supposed to expire",
+ "properties": {
+ "$date": {
+ "type": "number",
+ "description": "Milliseconds from epoch time"
+ }
+ }
+ },
+ "expired": {
+ "type": "boolean",
+ "description": "If the token has expired"
+ },
+ "username": {
+ "type": "string",
+ "description": "The user name associated with the token"
+ },
+ "email": {
+ "type": "string",
+ "description": "The email address asscoaited with the token"
+ },
+ "ip_address": {
+ "type": "array",
+ "description": "List of IP addresses the token is restricted to"
+ },
+ "properties": {
+ "type": "array",
+ "description": "An array of length 16 of integer values; each value defines a properties of the token"
+ }
+ }
+ }
+
+Token Properties
+****************
+
+The following table describes the ``properties`` array of a token:
+
++----------+-------------------------------------+
+| Position | Description |
++==========+=====================================+
+| 0 | If the token is an admin token. |
++----------+-------------------------------------+
+| 1 | If the token is a super-user token. |
++----------+-------------------------------------+
+| 2 | If the token can perform GET. |
++----------+-------------------------------------+
+| 3 | If the token can perform POST. |
++----------+-------------------------------------+
+| 4 | If the token can perform DELETE. |
++----------+-------------------------------------+
+| 5 | If the token is IP restricted. |
++----------+-------------------------------------+
+| 6 | If the token can create new tokens. |
++----------+-------------------------------------+
+| 7 - 15 | Not used. |
++----------+-------------------------------------+
+
+More Info
+*********
+
+* :ref:`API results <intro_schema_results>`
+* :ref:`Schema time and date <intro_schema_time_date>`
+