gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet-rest-api] branch master updated (5e5750f -> c4883a8


From: gnunet
Subject: [GNUnet-SVN] [gnunet-rest-api] branch master updated (5e5750f -> c4883a8)
Date: Sun, 12 Aug 2018 23:08:32 +0200

This is an automated email from the git hooks/post-receive script.

phil pushed a change to branch master
in repository gnunet-rest-api.

    from 5e5750f  Added identity and gns
     new 6042f0b  added identity get
     new 974ec01  -wip documentation
     new 802b073  add namestore
     new 8044937  Changed identity, gns and namestore
     new f615306  Changed identity, wip namestore
     new c89eef6  Added additional information for identity API
     new c4883a8  fix apis

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 source/conf.py       |   4 +-
 source/gns.rst       | 100 ++++++++++++-------
 source/identity.rst  | 273 +++++++++++++++++++++++++++++----------------------
 source/index.rst     |  30 +++---
 source/namestore.rst | 188 +++++++++++++++++++++++++++++++++++
 source/peerinfo.rst  |  98 ++++++++++++++++++
 6 files changed, 523 insertions(+), 170 deletions(-)
 create mode 100644 source/namestore.rst
 create mode 100644 source/peerinfo.rst

diff --git a/source/conf.py b/source/conf.py
index e5ed1eb..45ea518 100644
--- a/source/conf.py
+++ b/source/conf.py
@@ -74,7 +74,7 @@ pygments_style = 'sphinx'
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
 #
-html_theme = 'alabaster'
+html_theme = 'nature'
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
@@ -152,4 +152,4 @@ texinfo_documents = [
     (master_doc, 'GNUnetRESTAPI', 'GNUnet REST API Documentation',
      author, 'GNUnetRESTAPI', 'One line description of project.',
      'Miscellaneous'),
-]
\ No newline at end of file
+]
diff --git a/source/gns.rst b/source/gns.rst
index 70ac34c..53c9872 100644
--- a/source/gns.rst
+++ b/source/gns.rst
@@ -1,47 +1,71 @@
-GNUnet GNS API Service
-======================
+.. _ref-type:
 
-Variables in single quotes ``'...'`` can and must be changed according to your 
specific case.
+GNS API Service
+===============
 
-``name`` is the name of an identity.
+Definition
+~~~~~~~~~~
 
-``record_type`` is the record_type integer, the system returns. For example, 
``0`` = ANY, ``65536`` = PKEY. For more information look into the source code 
of "gnunet_gnsrecord_lib.h".
+Variables in single quotes ``'...'`` can or must be changed according to your 
specific case.
 
-============
-GET Requests
-============
+``lookup`` is the combination of the ``record_name`` of a :ref:`ref-gnsrecord` 
and the ``name`` of the zone (or identity): ``record_name.name``
 
-+--------------------+------------------------------------------------------------------------------------------+
-|**Title**           |Return all records for given name                        
                                 |
-+--------------------+------------------------------------------------------------------------------------------+
-|**URL**             |:literal:`/gns?name='name'&record_type='record_type'`    
                                 |
-+--------------------+------------------------------------------------------------------------------------------+
-|**Method**          |**GET**                                                  
                                 |
-+--------------------+------------------------------------------------------------------------------------------+
-|**Data Params**     |none                                                     
                                 |
-+--------------------+------------------------------------------------------------------------------------------+
-|**Success Response**|[*TODO* gns record to string,...]                        
                                 |
-+--------------------+------------------------------------------------------------------------------------------+
-|**Error Response**  |{"error":"*error_desc*"}                                 
                                 |
-+--------------------+------------------------------------------------------------------------------------------+
+``type`` is the record_type of a :ref:`ref-gnsrecord`.
 
+Error Response
+--------------
+
+An error response is sent in the JSON format: 
``{"error":"*error_description*"}``
+
+Following numbers are added for references inside the documentation only.
+
+Error descriptions are::
+    
+    Nr. Error Description           - Explanation
+    1)  Unknown Error               - Error is not specified
+    2)  Record not found            - GNS record was not found, this is 
combined with the HTTP Error Code 404 Not Found
+
+Error ``1)`` is always possible and is not listed in following requests.
+
+Requests
+~~~~~~~~
+
+GET Request
+-----------
+
+For this request ``record_type`` is optional. If missing or called with an 
invalid record_type, it will automatically be set to ANY.
+
+The success response is a :ref:`ref-gnsrecord` without its record_name.
+
++--------------------+----------------------------------------------------------------------------------------------------------------------------+
+|**Title**           |Return all records for given name                        
                                                                   |
++--------------------+----------------------------------------------------------------------------------------------------------------------------+
+|**URL**             |:literal:`/gns/'lookup'?record_type='type'`              
                                                                   |
++--------------------+----------------------------------------------------------------------------------------------------------------------------+
+|**Method**          |**GET**                                                  
                                                                   |
++--------------------+----------------------------------------------------------------------------------------------------------------------------+
+|**Data Params**     |none                                                     
                                                                   |
++--------------------+----------------------------------------------------------------------------------------------------------------------------+
+|**Success Response**| [{"value": "*value*", "record_type": "*type*", 
"expiration_time": "*time*", "flag": *flag*},...]                           |
++--------------------+----------------------------------------------------------------------------------------------------------------------------+
+|**Error Response**  | {"error":"*error_desc*"} :sup:`2`                       
                                                                   |
++--------------------+----------------------------------------------------------------------------------------------------------------------------+
 
-===============
 OPTIONS Request
-===============
+---------------
 
-+--------------------+---------------------------------------------------------+
-|**Title**           |Get request options                                      
|
-+--------------------+---------------------------------------------------------+
-|**URL**             |:literal:`/gns`                                          
|
-+--------------------+---------------------------------------------------------+
-|**Method**          |**OPTIONS**                                              
|
-+--------------------+---------------------------------------------------------+
-|**URL Params**      |none                                                     
|
-+--------------------+---------------------------------------------------------+
-|**Data Params**     |none                                                     
|
-+--------------------+---------------------------------------------------------+
-|**Success Response**|Access-Control-Allow-Methods: GET                        
|
-+--------------------+---------------------------------------------------------+
-|**Error Response**  |none                                                     
|
-+--------------------+---------------------------------------------------------+
++--------------------+----------------------------------------------------------------------------------------------------------------------------+
+|**Title**           |Get request options                                      
                                                                   |
++--------------------+----------------------------------------------------------------------------------------------------------------------------+
+|**URL**             |:literal:`/gns`                                          
                                                                   |
++--------------------+----------------------------------------------------------------------------------------------------------------------------+
+|**Method**          |**OPTIONS**                                              
                                                                   |
++--------------------+----------------------------------------------------------------------------------------------------------------------------+
+|**URL Params**      |none                                                     
                                                                   |
++--------------------+----------------------------------------------------------------------------------------------------------------------------+
+|**Data Params**     |none                                                     
                                                                   |
++--------------------+----------------------------------------------------------------------------------------------------------------------------+
+|**Success Response**|                                                         
                                                                   |
++--------------------+----------------------------------------------------------------------------------------------------------------------------+
+|**Error Response**  |none                                                     
                                                                   |
++--------------------+----------------------------------------------------------------------------------------------------------------------------+
diff --git a/source/identity.rst b/source/identity.rst
index 501745a..63dd2e7 100644
--- a/source/identity.rst
+++ b/source/identity.rst
@@ -1,14 +1,64 @@
-GNUnet Identity API Service
-===========================
+Identity API Service
+====================
 
-Variables in single quotes ``'...'`` can and must be changed according to your 
specific case.
+Definition
+~~~~~~~~~~
 
-``pubkey`` or ``public_key`` is the public key of an identity.
+Variables in single quotes ``'...'`` can or must be changed according to your 
specific case.
 
-``name`` is the name of an identity.
+``public_key`` is the public key of an identity.
 
-``subsystem`` is a subsystem of GNUnet.
+``name`` is the name of an identity. 
 
+``newname`` is the new name of an identity for the rename request.
+
+``subsystem`` is a subsystem, e.g. namestore.
+
+Identity
+--------
+
+An 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.
+
+
+Error Response
+--------------
+
+An error response is sent in the JSON format: 
``{"error":"*error_description*"}``
+
+Following numbers are added for references inside the documentation only.
+
+Error descriptions are::
+    
+    Nr. Error Description           - Explanation
+    1)  Unknown Error               - Error is not specified
+    2)  No identity found           - Identity was not found with given name, 
public key or no identity was found at all
+    3)  Missing identity public key - Identity public key length is zero
+    4)  Missing identity name       - Identity name length is zero
+    5)  Missing subsystem name      - Subsystem name length is zero
+    6)  No data                     - No JSON data given
+    7)  Data invalid                - Wrong JSON data given
+    8)  Rename failed               - Rename request failed due to wrong name, 
etc.
+    9)  Setting subsystem failed    - Setting the subsystem for an identity 
failed (usually this error does not occur)
+
+Error ``1)`` is always possible and is not listed in following requests.
+
+ATTENTION: 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.
+
+Response Code
+-------------
+
+A 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::
+
+    a) 200 OK         - Normal response (but may contain an error message)
+    b) 201 Created    - Success after POST request
+    c) 204 No Content - Success PUT or DELETE request
+    d) 404 Not Found  - Identity is not found with identifier
+    e) 409 Conflict   - PUT or POST request not possible due to existing 
duplicate
+    
+``d) 404 Not Found`` is always used when the error message is either ``2)``, 
``3)`` or ``4)``.
+
+Requests
+~~~~~~~~
 
 GET Requests
 ------------
@@ -16,7 +66,7 @@ GET Requests
 
+--------------------+---------------------------------------------------------------+
 |**Title**           |Returns all identities with name and public key          
      |
 
+--------------------+---------------------------------------------------------------+
-|**URL**             |:literal:`/identity`                                     
      |
+|**URL**             |:literal:`/identity/all`                                 
      |
 
+--------------------+---------------------------------------------------------------+
 |**Method**          |**GET**                                                  
      |
 
+--------------------+---------------------------------------------------------------+
@@ -26,33 +76,35 @@ GET Requests
 
+--------------------+---------------------------------------------------------------+
 |**Success Response**|[{"pubkey":"*public_key*", "name":"*name*"},...]         
      |
 
+--------------------+---------------------------------------------------------------+
-|**Error Response**  |{"error":"*error_desc*"}                                 
      |
+|**Error Response**  | {"error":"*error_desc*"} :sup:`2`                       
      |
++--------------------+---------------------------------------------------------------+
+|**Attention**       | The response in this request is an array!               
      |
 
+--------------------+---------------------------------------------------------------+
 
 |
 
-+--------------------+----------------------------------------------------+
-|**Title**           |Returns only a specific identity                    |
-+--------------------+----------------------------------------------------+
-|**URL**             |:literal:`/identity?pubkey='public_key'`            |
-+--------------------+----------------------------------------------------+
-|**Method**          |**GET**                                             |
-+--------------------+----------------------------------------------------+
-|**URL Params**      |none                                                |
-+--------------------+----------------------------------------------------+
-|**Data Params**     |none                                                |
-+--------------------+----------------------------------------------------+
-|**Success Response**|[{"pubkey":"*public_key*", "name":"*name*"}]        |
-+--------------------+----------------------------------------------------+
-|**Error Response**  |{"error":"*error_desc*"}                            |
-+--------------------+----------------------------------------------------+
++--------------------+----------------------------------------------------------------+
+|**Title**           |Returns only a specific identity                         
       |
++--------------------+----------------------------------------------------------------+
+|**URL**             | ``/identity/pubkey/'public_key'`` or 
``/identity/name/'name'`` |
++--------------------+----------------------------------------------------------------+
+|**Method**          |**GET**                                                  
       |
++--------------------+----------------------------------------------------------------+
+|**URL Params**      |none                                                     
       |
++--------------------+----------------------------------------------------------------+
+|**Data Params**     |none                                                     
       |
++--------------------+----------------------------------------------------------------+
+|**Success Response**|{"pubkey":"*public_key*", "name":"*name*"}               
       |
++--------------------+----------------------------------------------------------------+
+|**Error Response**  | {"error":"*error_desc*"} :sup:`2; 3 or 4`               
       |
++--------------------+----------------------------------------------------------------+
 
 |
 
 
+--------------------+---------------------------------------------------------------+
 |**Title**           |Returns default identity for specific subsystem          
      |
 
+--------------------+---------------------------------------------------------------+
-|**URL**             |:literal:`/identity?subsystem='subsystem'`               
      |
+|**URL**             |:literal:`/identity/subsystem/'subsystem'`               
      |
 
+--------------------+---------------------------------------------------------------+
 |**Method**          |**GET**                                                  
      |
 
+--------------------+---------------------------------------------------------------+
@@ -62,116 +114,103 @@ GET Requests
 
+--------------------+---------------------------------------------------------------+
 |**Success Response**|{"pubkey":"*public_key*", "name":"*name*"}               
      |
 
+--------------------+---------------------------------------------------------------+
-|**Error Response**  |{"error":"*error_desc*"}                                 
      |
-+--------------------+---------------------------------------------------------------+
-|**Attention**       |The response in this request is NOT an array!            
      |
+|**Error Response**  | {"error":"*error_desc*"} :sup:`2; 5`                    
      |
 
+--------------------+---------------------------------------------------------------+
 
-
 POST Request
 ------------
 
-+--------------------+----------------------------------------------------+
-|**Title**           |Creates an identity                                 |
-+--------------------+----------------------------------------------------+
-|**URL**             |:literal:`/identity`                                |
-+--------------------+----------------------------------------------------+
-|**Method**          |**POST**                                            |
-+--------------------+----------------------------------------------------+
-|**URL Params**      |none                                                |
-+--------------------+----------------------------------------------------+
-|**Data Params**     |{"name":'*name*'}                                   |
-+--------------------+----------------------------------------------------+
-|**Success Response**|Response Code: :literal:`201` (Created)             |
-+--------------------+----------------------------------------------------+
-|**Error Response**  | | {"error":"*error_desc*"}                         |
-|                    | | *or*                                             |
-|                    | | Response Code: :literal:`409` (Conflict)         |
-+--------------------+----------------------------------------------------+
++--------------------+---------------------------------------------------------------+
+|**Title**           |Creates an identity                                      
      |
++--------------------+---------------------------------------------------------------+
+|**URL**             |:literal:`/identity`                                     
      |
++--------------------+---------------------------------------------------------------+
+|**Method**          |**POST**                                                 
      |
++--------------------+---------------------------------------------------------------+
+|**URL Params**      |none                                                     
      |
++--------------------+---------------------------------------------------------------+
+|**Data Params**     | {"name":'*name*'}                                       
      |
++--------------------+---------------------------------------------------------------+
+|**Success Response**| Response Code: :literal:` b) 201 Created`               
      |
++--------------------+---------------------------------------------------------------+
+|**Error Response**  | | {"error":"*error_desc*"} :sup:`6; 7`                  
      |
+|                    | | *or*                                                  
      |
+|                    | | Response Code: ``e) 409 Conflict`` if name in use     
      |
++--------------------+---------------------------------------------------------------+
 
 PUT Request
 -----------
 
-+--------------------+----------------------------------------------------+
-|**Title**           |Changes name of identity                            |
-+--------------------+----------------------------------------------------+
-|**URL**             |:literal:`/identity`                                |
-+--------------------+----------------------------------------------------+
-|**Method**          |**PUT**                                             |
-+--------------------+----------------------------------------------------+
-|**URL Params**      |none                                                |
-+--------------------+----------------------------------------------------+
-|**Data Params**     | {"newname":'*name*', "pubkey": '*public_key*'}     |
-+--------------------+----------------------------------------------------+
-|**Success Response**|Response Code: :literal:`204` (No Content)          |
-+--------------------+----------------------------------------------------+
-|**Error Response**  | | {"error":"*error_desc*"}                         |
-|                    | | *or*                                             |
-|                    | | Response Code: :literal:`404` (Not Found)        |
-|                    | | *or*                                             |
-|                    | | Response Code: :literal:`409` (Conflict)         |
-+--------------------+----------------------------------------------------+
++--------------------+----------------------------------------------------------------+
+|**Title**           |Changes name of identity                                 
       |
++--------------------+----------------------------------------------------------------+
+|**URL**             | ``/identity/pubkey/'public_key'`` or 
``/identity/name/'name'`` |
++--------------------+----------------------------------------------------------------+
+|**Method**          |**PUT**                                                  
       |
++--------------------+----------------------------------------------------------------+
+|**URL Params**      |none                                                     
       |
++--------------------+----------------------------------------------------------------+
+|**Data Params**     | {"newname":'*newname*'}                                 
       |
++--------------------+----------------------------------------------------------------+
+|**Success Response**| Response Code: :literal:`c) 204 No Content`             
       |
++--------------------+----------------------------------------------------------------+
+|**Error Response**  | | {"error":"*error_desc*"} :sup:`2; 3 or 4; 6; 7; 8`    
       |
+|                    | | *or*                                                  
       |
+|                    | | Response Code: :literal:`e) 409 Conflict` if newname 
in use  |
++--------------------+----------------------------------------------------------------+
 
 |
 
-+--------------------+----------------------------------------------------+
-|**Title**           |Sets identity as default for a subsystem            |
-+--------------------+----------------------------------------------------+
-|**URL**             |:literal:`/identity`                                |
-+--------------------+----------------------------------------------------+
-|**Method**          |**PUT**                                             |
-+--------------------+----------------------------------------------------+
-|**URL Params**      |none                                                |
-+--------------------+----------------------------------------------------+
-|**Data Params**     | {"subsystem":'*name*', "pubkey": '*public_key*'}   |
-+--------------------+----------------------------------------------------+
-|**Success Response**|Response Code: :literal:`204` (No Content)          |
-+--------------------+----------------------------------------------------+
-|**Error Response**  | | {"error":"*error_desc*"}                         |
-|                    | | *or*                                             |
-|                    | | Response Code: :literal:`404` (Not Found)        |
-|                    | | *or*                                             |
-|                    | | Response Code: :literal:`409` (Conflict)         |
-+--------------------+----------------------------------------------------+
-
++--------------------+----------------------------------------------------------------+
+|**Title**           |Sets identity as default for a subsystem                 
       |
++--------------------+----------------------------------------------------------------+
+|**URL**             | ``/identity/subsystem/'name'``                          
       |
++--------------------+----------------------------------------------------------------+
+|**Method**          |**PUT**                                                  
       |
++--------------------+----------------------------------------------------------------+
+|**URL Params**      |none                                                     
       |
++--------------------+----------------------------------------------------------------+
+|**Data Params**     | {"subsystem":'*subsystem*'}                             
       |
++--------------------+----------------------------------------------------------------+
+|**Success Response**| Response Code: :literal:`c) 204 No Content`             
       |
++--------------------+----------------------------------------------------------------+
+|**Error Response**  | {"error":"*error_desc*"} :sup:`2; 4; 6; 7; 9`           
       |
++--------------------+----------------------------------------------------------------+
 
 DELETE Request
 --------------
 
-+--------------------+----------------------------------------------------+
-|**Title**           |Deletes specific identity                           |
-+--------------------+----------------------------------------------------+
-|**URL**             |:literal:`/identity?pubkey='public_key'`            |
-+--------------------+----------------------------------------------------+
-|**Method**          |**DELETE**                                          |
-+--------------------+----------------------------------------------------+
-|**URL Params**      |none                                                |
-+--------------------+----------------------------------------------------+
-|**Data Params**     |none                                                |
-+--------------------+----------------------------------------------------+
-|**Success Response**|Response Code: :literal:`204` (No Content)          |
-+--------------------+----------------------------------------------------+
-|**Error Response**  | | {"error":"*error_desc*"}                         |
-|                    | | *or*                                             |
-|                    | | Response Code: :literal:`404` (Not Found)        |
-+--------------------+----------------------------------------------------+
-
++--------------------+----------------------------------------------------------------+
+|**Title**           |Deletes specific identity                                
       |
++--------------------+----------------------------------------------------------------+
+|**URL**             | ``/identity/pubkey/'public_key'`` or 
``/identity/name/'name'`` |
++--------------------+----------------------------------------------------------------+
+|**Method**          |**DELETE**                                               
       |
++--------------------+----------------------------------------------------------------+
+|**URL Params**      |none                                                     
       |
++--------------------+----------------------------------------------------------------+
+|**Data Params**     |none                                                     
       |
++--------------------+----------------------------------------------------------------+
+|**Success Response**| Response Code: :literal:`c) 204 No Content`             
       |
++--------------------+----------------------------------------------------------------+
+|**Error Response**  | {"error":"*error_desc*"} :sup:`2; 3 or 4`               
       |
++--------------------+----------------------------------------------------------------+
 
 OPTIONS Request
 ---------------
 
-+--------------------+---------------------------------------------------------+
-|**Title**           |Gets request options                                     
|
-+--------------------+---------------------------------------------------------+
-|**URL**             |:literal:`/identity`                                     
|
-+--------------------+---------------------------------------------------------+
-|**Method**          |**OPTIONS**                                              
|
-+--------------------+---------------------------------------------------------+
-|**URL Params**      |none                                                     
|
-+--------------------+---------------------------------------------------------+
-|**Data Params**     |none                                                     
|
-+--------------------+---------------------------------------------------------+
-|**Success Response**|Access-Control-Allow-Methods: 
GET,POST,PUT,DELETE,OPTIONS|
-+--------------------+---------------------------------------------------------+
-|**Error Response**  |none                                                     
|
-+--------------------+---------------------------------------------------------+
++--------------------+----------------------------------------------------------------+
+|**Title**           |Gets request options                                     
       |
++--------------------+----------------------------------------------------------------+
+|**URL**             |:literal:`/identity`                                     
       |
++--------------------+----------------------------------------------------------------+
+|**Method**          |**OPTIONS**                                              
       |
++--------------------+----------------------------------------------------------------+
+|**URL Params**      |none                                                     
       |
++--------------------+----------------------------------------------------------------+
+|**Data Params**     |none                                                     
       |
++--------------------+----------------------------------------------------------------+
+|**Success Response**|                                                         
       |
++--------------------+----------------------------------------------------------------+
+|**Error Response**  |none                                                     
       |
++--------------------+----------------------------------------------------------------+
diff --git a/source/index.rst b/source/index.rst
index b31dec1..4fc373e 100644
--- a/source/index.rst
+++ b/source/index.rst
@@ -3,18 +3,18 @@
    You can adapt this file completely to your liking, but it should at least
    contain the root `toctree` directive.
 
-Welcome to GNUnet REST API's documentation!
-===========================================
-   
-========
-Requests
-========
+Welcome to the REST API's documentation!
+========================================
+
+
+REST API
+~~~~~~~~
 
 The GNUnet Web API is based in REST principles. Data resources are accessed 
via HTTP requests to an API endpoint. Where possible, the Web API uses the 
following HTTP methods for each action:
 
 +----------+-----------------------------+
 |**Method**|**Action**                   |
-+----------+-----------------------------+
++==========+=============================+
 |GET       |Retrieve object(s)           |
 +----------+-----------------------------+
 |POST      |Create new object(s)         |
@@ -23,21 +23,25 @@ The GNUnet Web API is based in REST principles. Data 
resources are accessed via
 +----------+-----------------------------+
 |DELETE    |Delete existing object(s)    |
 +----------+-----------------------------+
+|OPTIONS   |Get allowed headers          |
++----------+-----------------------------+
 
+Services
+~~~~~~~~
 
 .. toctree::
-   :maxdepth: 2
+   :maxdepth: 3
    :caption: Contents:
     
    identity
+   namestore
    gns
+   peerinfo
 
 
 
-==================
-Indices and tables
-==================
+======
+Search
+======
 
-* :ref:`genindex`
-* :ref:`modindex`
 * :ref:`search`
diff --git a/source/namestore.rst b/source/namestore.rst
new file mode 100644
index 0000000..85aba3a
--- /dev/null
+++ b/source/namestore.rst
@@ -0,0 +1,188 @@
+Namestore API Service
+=====================
+
+Definition
+~~~~~~~~~~
+
+Variables in single quotes ``'...'`` can or must be changed according to your 
specific case.
+
+``name`` is the name of a zone. A zone is the name of an identity in this case.
+
+.. _ref-gnsrecord:
+
+GNS Record
+----------
+
+Namestore entries are GNS records. GNS records have a ``record_type``, a 
``value``, an ``expiration_time``, a ``flag`` and a ``record_name``.
+Adding a GNS records with the same record_name overwrites the old GNS record.
+
+A GNS record is sent in the JSON format: ``{"value": "value", "record_type": 
"type", "expiration_time": "time", "flag": flag, "record_name": "rname"}``
+
+``type`` is the type of the record, e.g. "PKEY" for private key. It can be 
ANY, PKEY, NICK, LEHO, VPN, GNS2DNS, BOX, PLACE, PHONE, ID_ATTR, ID_TOKEN, 
ID_TOKEN_METADATA, CREDENTIAL, POLICY, ATTRIBUTE, ABE_KEY, ABE_MASTER. You can 
find more information in header ``src/gnunet_gnsrecord_lib.h``
+
+``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.
+
+``rname`` is the name of the record.
+
+Error Response
+--------------
+
+An error response is sent in the JSON format: 
``{"error":"*error_description*"}``
+
+Following numbers are added for references inside the documentation only.
+
+Error descriptions are::
+    
+    Nr. Error Description           - Explanation
+    1)  Unknown Error               - Error is not specified
+    2)  No identity found           - Identity was not found with given name, 
this is combined with the HTTP Error Code 404 Not Found
+    3)  No default zone specified   - Identity name was not given and no 
identiy was added to the subsystem namestore 
+    4)  Namestore action failed     - The task of the namestore API (not REST 
API) failed
+    5)  No data                     - Missing data
+    6)  Data invalid                - Wrong data given
+    7)  Error storing records       - POST request failed
+    8)  Deleting record failed      - DELETE request failed
+    9)  No record found             - Delete failed due to missing record, 
this is combined with the HTTP Error Code 404 Not Found
+
+Error ``1)`` is always possible and is not listed in following requests.
+
+ATTENTION: Any error message from the Namestore API (not REST API) can occur 
and can be returned in the error response. These responses are not listed here.
+
+Requests
+~~~~~~~~
+
+GET Request
+------------
+
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Title**           |Returns all namestore entries of default identity        
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL**             |:literal:`/namestore`                                    
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Method**          |**GET**                                                  
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL Params**      |none                                                     
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Data Params**     |none                                                     
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Success Response**|[{"value": "*value*", "record_type": "*type*", 
"expiration_time": "*time*", "flag": *flag*, "record_name": "*rname*"},...] |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Error Response**  | {"error":"*error_desc*"} :sup:`3; 4`                    
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+
+|
+
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Title**           |Returns all namestore entries for one zone specified by 
its name                                                           |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL**             |:literal:`/namestore/'name'`                             
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Method**          |**GET**                                                  
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL Params**      |none                                                     
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Data Params**     |none                                                     
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Success Response**|[{"value": "*value*", "record_type": "*type*", 
"expiration_time": "*time*", "flag": *flag*, "record_name": "*rname*"},...] |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Error Response**  | {"error":"*error_desc*"} :sup:`2; 4`                    
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+
+POST Request
+------------
+
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Title**           |Creates a namestore entry for default identity           
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL**             |:literal:`/namestore`                                    
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Method**          |**POST**                                                 
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL Params**      |none                                                     
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Data Params**     |{"value": "*value*", "record_type": "*type*", 
"expiration_time": "*time*", "flag": *flag*, "record_name": "*rname*"}       |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Success Response**|Response Code: :literal:`204` (No Content)               
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Error Response**  | {"error":"*error_desc*"} :sup:`3; 4; 5; 6; 7`           
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+
+|
+
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Title**           |Creates a namestore entry for one zone specified by its 
name                                                               |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL**             |:literal:`/namestore/'name'`                             
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Method**          |**POST**                                                 
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL Params**      |none                                                     
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Data Params**     |{"value": "*value*", "record_type": "*type*", 
"expiration_time": "*time*", "flag": *flag*, "record_name": "*rname*"}       |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Success Response**|Response Code: :literal:`204` (No Content)               
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Error Response**  | {"error":"*error_desc*"} :sup:`2; 4; 5; 6; 7`           
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+
+
+DELETE Request
+--------------
+
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+| **Title**          | Deletes specific namestore entry for default identity   
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL**             |:literal:`/namestore?record_name='rname'`                
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Method**          | **DELETE**                                              
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL Params**      | none                                                    
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Data Params**     | none                                                    
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Success Response**| Response Code: :literal:`204` (No Content)              
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Error Response**  | {"error":"*error_desc*"} :sup:`3; 4; 6; 8; 9`           
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+
+|
+
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+| **Title**          | Deletes specific namestore entry in specific zone       
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL**             |:literal:`/namestore/'name'?record_name='rname'`         
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Method**          | **DELETE**                                              
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL Params**      | none                                                    
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Data Params**     | none                                                    
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Success Response**| Response Code: :literal:`204` (No Content)              
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Error Response**  | {"error":"*error_desc*"} :sup:`2; 4; 6; 8; 9`           
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+
+
+OPTIONS Request
+---------------
+
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Title**           |Gets request options                                     
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL**             |:literal:`/namestore`                                    
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Method**          |**OPTIONS**                                              
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL Params**      |none                                                     
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Data Params**     |none                                                     
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Success Response**|                                                         
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Error Response**  |none                                                     
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
diff --git a/source/peerinfo.rst b/source/peerinfo.rst
new file mode 100644
index 0000000..1d79a27
--- /dev/null
+++ b/source/peerinfo.rst
@@ -0,0 +1,98 @@
+Peerinfo API Service
+====================
+
+Definition
+~~~~~~~~~~
+
+Variables in single quotes ``'...'`` can or must be changed according to your 
specific case.
+
+``friend`` is to enable the optional friend information. It is either ``yes`` 
or can be left away.
+
+Peer
+----
+
+A peer consists of an ``identifier`` and one or more ``addresses`` with 
``expiration dates``.
+
+Peerinfo Response
+-----------------
+
+The response of the peerinfo API is a JSON Array::
+
+    [
+      {
+        "peer":'identifier', 
+        "array": [
+                   {
+                     "address":'peer_address',
+                     "expires":'address_expiration'
+                   }, 
+                   ...
+                 ]
+      },
+      ...
+    ]
+    
+``ìdentifier`` is a 52-character, alphanumeric identifier of the peer.
+
+``peer_address`` is one URI as string.
+
+``address_expiration`` is the date, when the address expires, e.g. "Wed Aug 1 
10:00:00 2018".
+
+    
+Error Response
+--------------
+
+An error response is sent in the JSON format: 
``{"error":"*error_description*"}``
+
+Following numbers are added for references inside the documentation only.
+
+Error descriptions are::
+    
+    Nr. Error Description           - Explanation
+    1)  Unknown Error               - Error is not specified
+    2)  No peers found              - Peers were not found, this is combined 
with the HTTP Error Code 404 Not Found
+
+Error ``1)`` is always possible and is not listed in following requests.
+
+ATTENTION: Any error message from the Peerinfo API (not REST API) can occur 
and can be returned in the error response. These responses are not listed here.
+
+Requests
+~~~~~~~~
+
+GET Request
+------------
+
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Title**           | Returns all peers and resolves their addresses          
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL**             | :literal:`/peerinfo`                                    
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Method**          | **GET**                                                 
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL Params**      | ``?friend='friend'`` optional                           
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Data Params**     | none                                                    
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Success Response**| Peerinfo Response *or* Response Code: ``500 Internal 
Server Error``                                                       |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Error Response**  | {"error":"*error_desc*"} :sup:`2`                       
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+
+OPTIONS Request
+---------------
+
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Title**           |Gets request options                                     
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL**             |:literal:`/peerinfo`                                     
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Method**          |**OPTIONS**                                              
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**URL Params**      |none                                                     
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Data Params**     |none                                                     
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Success Response**|                                                         
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**Error Response**  |none                                                     
                                                                  |
++--------------------+---------------------------------------------------------------------------------------------------------------------------+

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]