summaryrefslogtreecommitdiff
path: root/source/namestore.rst
blob: 35eb1049a5628aec1f7773ecbe355f8ec437c7ee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
GNUnet Namestore API Service
============================

Variables in single quotes ``'...'`` can or must be changed according to your specific case.

Namestore communicates with GNS records.

``type`` is the type of the record, e.g. "PKEY" for private key. Possible types are listed in :ref:`ref-type`.

``value`` is the value of the specific type of the record, e.g. the private key of an identity.

``time`` is the expiration time of the record either "never" or fancy time (see GNUNET_STRINGS_fancy_time_to_absolute)

``flag`` is the option of the record. Either 0 for none, 2 for private, 8 for relative expiration or 16 if all other records have expired. ``flag`` must be a number

``label`` is the name of the record. No duplicates are allowed.

``error_desc`` is the description of the returned error.


GET Request
------------

+--------------------+---------------------------------------------------------------------------------------------------------------------------+
|**Title**           |Returns all namestore entries                                                                                              |
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
|**URL**             |:literal:`/namestore`                                                                                                      |
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
|**Method**          |**GET**                                                                                                                    |
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
|**URL Params**      |none                                                                                                                       |
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
|**Data Params**     |none                                                                                                                       |
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
|**Success Response**|[{"value": "*value*", "type": "*type*", "expiration_time": "*time*", "flag": *flag*, "label": "*name*"},...]               |
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
|**Error Response**  |{"error":"*error_desc*"}                                                                                                   |
+--------------------+---------------------------------------------------------------------------------------------------------------------------+


POST Request
------------

+--------------------+------------------------------------------------------------------------------------------------------+
|**Title**           |Creates a namestore entry                                                                             |
+--------------------+------------------------------------------------------------------------------------------------------+
|**URL**             |:literal:`/namestore`                                                                                 |
+--------------------+------------------------------------------------------------------------------------------------------+
|**Method**          |**POST**                                                                                              |
+--------------------+------------------------------------------------------------------------------------------------------+
|**URL Params**      |none                                                                                                  |
+--------------------+------------------------------------------------------------------------------------------------------+
|**Data Params**     |{"value": "*value*", "type": "*type*", "expiration_time": "*time*", "flag": *flag*, "label": "*name*"}|
+--------------------+------------------------------------------------------------------------------------------------------+
|**Success Response**|Response Code: :literal:`204` (No Content)                                                            |
+--------------------+------------------------------------------------------------------------------------------------------+
|**Error Response**  | | {"error":"*error_desc*"}                                                                           |
|                    | | *or*                                                                                               |
|                    | | Response Code: :literal:`409` (Conflict)                                                           |
+--------------------+------------------------------------------------------------------------------------------------------+


DELETE Request
--------------

+--------------------+----------------------------------------------------+
| **Title**          | Deletes specific namestore entry                   |
+--------------------+----------------------------------------------------+
|**URL**             |:literal:`/namestore?label='label'`                 |
+--------------------+----------------------------------------------------+
|**Method**          | **DELETE**                                         |
+--------------------+----------------------------------------------------+
|**URL Params**      | none                                               |
+--------------------+----------------------------------------------------+
|**Data Params**     | none                                               |
+--------------------+----------------------------------------------------+
|**Success Response**| Response Code: :literal:`204` (No Content)         |
+--------------------+----------------------------------------------------+
|**Error Response**  | {"error":"*error_desc*"}                           |
+--------------------+----------------------------------------------------+