summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil <phil.buschmann@tum.de>2018-08-12 01:40:14 +0200
committerPhil <phil.buschmann@tum.de>2018-08-12 01:40:14 +0200
commitc89eef6cc42b6d7bfcfd761f1c9f7cf260c006e7 (patch)
treece557b8229186e43ff3dab5c6fa08d524c8a7ee7
parentf61530615e0be70e389a5f84006ad047a1a7168c (diff)
downloadgnunet-rest-api-c89eef6cc42b6d7bfcfd761f1c9f7cf260c006e7.tar.gz
gnunet-rest-api-c89eef6cc42b6d7bfcfd761f1c9f7cf260c006e7.zip
Added additional information for identity API
-rw-r--r--source/identity.rst155
1 files changed, 101 insertions, 54 deletions
diff --git a/source/identity.rst b/source/identity.rst
index dd68fae..11b2d29 100644
--- a/source/identity.rst
+++ b/source/identity.rst
@@ -1,14 +1,64 @@
1GNUnet Identity API Service 1GNUnet Identity API Service
2=========================== 2===========================
3 3
4Definition
5==========
6
4Variables in single quotes ``'...'`` can or must be changed according to your specific case. 7Variables in single quotes ``'...'`` can or must be changed according to your specific case.
5 8
6``public_key`` is the public key of an identity. 9``public_key`` is the public key of an identity.
7 10
8``name`` is the name of an identity. ``newname`` is the new name of an identity. 11``name`` is the name of an identity.
12
13``newname`` is the new name of an identity for the rename request.
14
15``subsystem`` is a subsystem, e.g. namestore.
16
17Identity
18--------
19
20An identity consists of a ``public key`` and a ``name``. An identity can be assigned to a ``subsystem``. Each subsystem can only have one default identity.
21
22
23Error Response
24--------------
25
26An error response is sent in the JSON format: ``{"error":"*error_description*"}``
27
28Numbers are added for references inside the documentation only.
9 29
10``subsystem`` is a subsystem of GNUnet. 30Error descriptions are::
31
32 Nr. Error Description - Explanation
33 1) Unknown Error - Error is not specified
34 2) No identity found - Identity was not found with given name, public key or no identity was found at all
35 3) Missing identity public key - Identity public key length is zero
36 4) Missing identity name - Identity name length is zero
37 5) Missing subsystem name - Subsystem name length is zero
38 6) No data - No JSON data given
39 7) Data invalid - Wrong JSON data given
40 8) Rename failed - Rename request failed due to wrong name, etc.
41 9) Setting subsystem failed - Setting the subsystem for an identity failed (usually this error does not occur)
11 42
43Error ``1)`` is always possible and is not listed in following requests.
44
45ATTENTION: Any error message from the Identity API (not REST API) can occur and can be returned in the error response. These responses are not listed here.
46
47Response Code
48-------------
49
50A response of a message has a HTTP response code. Usually, this code is 200 OK for a successful response. The code changes in some cases::
51
52 a) 200 OK - Normal response (but may contain an error message)
53 b) 201 Created - Success after POST request
54 c) 204 No Content - Success PUT or DELETE request
55 d) 404 Not Found - Identity is not found with identifier
56 e) 409 Conflict - PUT or POST request not possible due to existing duplicate
57
58``d) 404 Not Found`` is always used when the error message is either ``2)``, ``3)`` or ``4)``.
59
60Requests
61========
12 62
13GET Requests 63GET Requests
14------------ 64------------
@@ -26,7 +76,7 @@ GET Requests
26+--------------------+---------------------------------------------------------------+ 76+--------------------+---------------------------------------------------------------+
27|**Success Response**|[{"pubkey":"*public_key*", "name":"*name*"},...] | 77|**Success Response**|[{"pubkey":"*public_key*", "name":"*name*"},...] |
28+--------------------+---------------------------------------------------------------+ 78+--------------------+---------------------------------------------------------------+
29|**Error Response** |{"error":"*error_desc*"} | 79|**Error Response** | ``2) No identity found`` |
30+--------------------+---------------------------------------------------------------+ 80+--------------------+---------------------------------------------------------------+
31|**Attention** | The response in this request is an array! | 81|**Attention** | The response in this request is an array! |
32+--------------------+---------------------------------------------------------------+ 82+--------------------+---------------------------------------------------------------+
@@ -46,7 +96,8 @@ GET Requests
46+--------------------+----------------------------------------------------------------+ 96+--------------------+----------------------------------------------------------------+
47|**Success Response**|{"pubkey":"*public_key*", "name":"*name*"} | 97|**Success Response**|{"pubkey":"*public_key*", "name":"*name*"} |
48+--------------------+----------------------------------------------------------------+ 98+--------------------+----------------------------------------------------------------+
49|**Error Response** |{"error":"*error_desc*"} | 99|**Error Response** | | ``2) No identity found``; ``3) Missing identity public key`` |
100| | | or ``4) Missing identity name`` |
50+--------------------+----------------------------------------------------------------+ 101+--------------------+----------------------------------------------------------------+
51 102
52| 103|
@@ -64,30 +115,29 @@ GET Requests
64+--------------------+---------------------------------------------------------------+ 115+--------------------+---------------------------------------------------------------+
65|**Success Response**|{"pubkey":"*public_key*", "name":"*name*"} | 116|**Success Response**|{"pubkey":"*public_key*", "name":"*name*"} |
66+--------------------+---------------------------------------------------------------+ 117+--------------------+---------------------------------------------------------------+
67|**Error Response** |{"error":"*error_desc*"} | 118|**Error Response** | ``2) No identity found``; ``5) Missing subsystem name`` |
68+--------------------+---------------------------------------------------------------+ 119+--------------------+---------------------------------------------------------------+
69 120
70
71POST Request 121POST Request
72------------ 122------------
73 123
74+--------------------+----------------------------------------------------+ 124+--------------------+---------------------------------------------------------------+
75|**Title** |Creates an identity | 125|**Title** |Creates an identity |
76+--------------------+----------------------------------------------------+ 126+--------------------+---------------------------------------------------------------+
77|**URL** |:literal:`/identity` | 127|**URL** |:literal:`/identity` |
78+--------------------+----------------------------------------------------+ 128+--------------------+---------------------------------------------------------------+
79|**Method** |**POST** | 129|**Method** |**POST** |
80+--------------------+----------------------------------------------------+ 130+--------------------+---------------------------------------------------------------+
81|**URL Params** |none | 131|**URL Params** |none |
82+--------------------+----------------------------------------------------+ 132+--------------------+---------------------------------------------------------------+
83|**Data Params** | {"name":'*name*'} | 133|**Data Params** | {"name":'*name*'} |
84+--------------------+----------------------------------------------------+ 134+--------------------+---------------------------------------------------------------+
85|**Success Response**|Response Code: :literal:`201` (Created) | 135|**Success Response**| Response Code: :literal:` b) 201 Created` |
86+--------------------+----------------------------------------------------+ 136+--------------------+---------------------------------------------------------------+
87|**Error Response** | | {"error":"*error_desc*"} | 137|**Error Response** | | ``6) No data``; ``7) Data invalid`` |
88| | | *or* | 138| | | *or* |
89| | | Response Code: :literal:`409` (Conflict) | 139| | | Response Code: ``e) 409 Conflict`` if name in use |
90+--------------------+----------------------------------------------------+ 140+--------------------+---------------------------------------------------------------+
91 141
92PUT Request 142PUT Request
93----------- 143-----------
@@ -103,13 +153,13 @@ PUT Request
103+--------------------+----------------------------------------------------------------+ 153+--------------------+----------------------------------------------------------------+
104|**Data Params** | {"newname":'*newname*'} | 154|**Data Params** | {"newname":'*newname*'} |
105+--------------------+----------------------------------------------------------------+ 155+--------------------+----------------------------------------------------------------+
106|**Success Response**|Response Code: :literal:`204` (No Content) | 156|**Success Response**| Response Code: :literal:`c) 204 No Content` |
107+--------------------+----------------------------------------------------------------+ 157+--------------------+----------------------------------------------------------------+
108|**Error Response** | | {"error":"*error_desc*"} | 158|**Error Response** | | ``2) No identity found``; ``3) Missing identity public key`` |
159| | | or ``4) Missing identity name``; ``6) No data``; |
160| | | ``7) Data invalid``; ``8) Rename failed`` |
109| | | *or* | 161| | | *or* |
110| | | Response Code: :literal:`404` (Not Found) | 162| | | Response Code: :literal:`e) 409 Conflict` if newname in use |
111| | | *or* |
112| | | Response Code: :literal:`409` (Conflict) |
113+--------------------+----------------------------------------------------------------+ 163+--------------------+----------------------------------------------------------------+
114 164
115| 165|
@@ -117,7 +167,7 @@ PUT Request
117+--------------------+----------------------------------------------------------------+ 167+--------------------+----------------------------------------------------------------+
118|**Title** |Sets identity as default for a subsystem | 168|**Title** |Sets identity as default for a subsystem |
119+--------------------+----------------------------------------------------------------+ 169+--------------------+----------------------------------------------------------------+
120|**URL** | ``/identity/pubkey/'public_key'`` or ``/identity/name/'name'`` | 170|**URL** | ``/identity/subsystem/'name'`` |
121+--------------------+----------------------------------------------------------------+ 171+--------------------+----------------------------------------------------------------+
122|**Method** |**PUT** | 172|**Method** |**PUT** |
123+--------------------+----------------------------------------------------------------+ 173+--------------------+----------------------------------------------------------------+
@@ -125,13 +175,11 @@ PUT Request
125+--------------------+----------------------------------------------------------------+ 175+--------------------+----------------------------------------------------------------+
126|**Data Params** | {"subsystem":'*subsystem*'} | 176|**Data Params** | {"subsystem":'*subsystem*'} |
127+--------------------+----------------------------------------------------------------+ 177+--------------------+----------------------------------------------------------------+
128|**Success Response**|Response Code: :literal:`204` (No Content) | 178|**Success Response**| Response Code: :literal:`c) 204 No Content` |
129+--------------------+----------------------------------------------------------------+ 179+--------------------+----------------------------------------------------------------+
130|**Error Response** | | {"error":"*error_desc*"} | 180|**Error Response** | | ``2) No identity found``; ``4) Missing identity name``; |
131| | | *or* | 181| | | ``6) No data``; ``7) Data invalid``; |
132| | | Response Code: :literal:`404` (Not Found) | 182| | | ``9) Setting subsystem failed`` |
133| | | *or* |
134| | | Response Code: :literal:`409` (Conflict) |
135+--------------------+----------------------------------------------------------------+ 183+--------------------+----------------------------------------------------------------+
136 184
137DELETE Request 185DELETE Request
@@ -148,28 +196,27 @@ DELETE Request
148+--------------------+----------------------------------------------------------------+ 196+--------------------+----------------------------------------------------------------+
149|**Data Params** |none | 197|**Data Params** |none |
150+--------------------+----------------------------------------------------------------+ 198+--------------------+----------------------------------------------------------------+
151|**Success Response**|Response Code: :literal:`204` (No Content) | 199|**Success Response**| Response Code: :literal:`c) 204 No Content` |
152+--------------------+----------------------------------------------------------------+ 200+--------------------+----------------------------------------------------------------+
153|**Error Response** | | {"error":"*error_desc*"} | 201|**Error Response** | | ``2) No identity found``; ``3) Missing identity public key`` |
154| | | *or* | 202| | | or ``4) Missing identity name`` |
155| | | Response Code: :literal:`404` (Not Found) |
156+--------------------+----------------------------------------------------------------+ 203+--------------------+----------------------------------------------------------------+
157 204
158OPTIONS Request 205OPTIONS Request
159--------------- 206---------------
160 207
161+--------------------+---------------------------------------------------------+ 208+--------------------+----------------------------------------------------------------+
162|**Title** |Gets request options | 209|**Title** |Gets request options |
163+--------------------+---------------------------------------------------------+ 210+--------------------+----------------------------------------------------------------+
164|**URL** |:literal:`/identity` | 211|**URL** |:literal:`/identity` |
165+--------------------+---------------------------------------------------------+ 212+--------------------+----------------------------------------------------------------+
166|**Method** |**OPTIONS** | 213|**Method** |**OPTIONS** |
167+--------------------+---------------------------------------------------------+ 214+--------------------+----------------------------------------------------------------+
168|**URL Params** |none | 215|**URL Params** |none |
169+--------------------+---------------------------------------------------------+ 216+--------------------+----------------------------------------------------------------+
170|**Data Params** |none | 217|**Data Params** |none |
171+--------------------+---------------------------------------------------------+ 218+--------------------+----------------------------------------------------------------+
172|**Success Response**| | 219|**Success Response**| |
173+--------------------+---------------------------------------------------------+ 220+--------------------+----------------------------------------------------------------+
174|**Error Response** |none | 221|**Error Response** |none |
175+--------------------+---------------------------------------------------------+ 222+--------------------+----------------------------------------------------------------+