gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet-rest-api] 07/08: fix apis


From: gnunet
Subject: [GNUnet-SVN] [gnunet-rest-api] 07/08: fix apis
Date: Tue, 30 Apr 2019 16:44:57 +0200

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

martin-schanzenbach pushed a commit to branch master
in repository gnunet-rest-api.

commit c4883a8df28fef1021b77f42348d601dddbc82ca
Author: Phil <address@hidden>
AuthorDate: Sun Aug 12 23:07:29 2018 +0200

    fix apis
---
 source/gns.rst       |  97 ++++++++++++--------
 source/identity.rst  |  30 +++----
 source/index.rst     |  31 ++++---
 source/namestore.rst | 247 +++++++++++++++++++++++++--------------------------
 source/peerinfo.rst  |  98 ++++++++++++++++++++
 5 files changed, 305 insertions(+), 198 deletions(-)

diff --git a/source/gns.rst b/source/gns.rst
index 240a9d9..53c9872 100644
--- a/source/gns.rst
+++ b/source/gns.rst
@@ -1,50 +1,71 @@
 .. _ref-type:
 
-GNUnet GNS API Service
-======================
+GNS API Service
+===============
+
+Definition
+~~~~~~~~~~
 
 Variables in single quotes ``'...'`` can or must be changed according to your 
specific case.
 
-``name`` is the name of an identity.
+``lookup`` is the combination of the ``record_name`` of a :ref:`ref-gnsrecord` 
and the ``name`` of the zone (or identity): ``record_name.name``
 
-``record_type`` is the record_type. 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``
+``type`` is the record_type of a :ref:`ref-gnsrecord`.
 
-============
-GET Requests
-============
+Error Response
+--------------
 
-For this request ``record_type`` is optional. If called with an invalid 
record_type, it will automatically be set to ANY.
+An error response is sent in the JSON format: 
``{"error":"*error_description*"}``
 
-+--------------------+--------------------------------------------------------------------------------------------------------------+
-|**Title**           |Return all records for given name                        
                                                     |
-+--------------------+--------------------------------------------------------------------------------------------------------------+
-|**URL**             |:literal:`/gns?name='name'&record_type='record_type'`    
                                                     |
-+--------------------+--------------------------------------------------------------------------------------------------------------+
-|**Method**          |**GET**                                                  
                                                     |
-+--------------------+--------------------------------------------------------------------------------------------------------------+
-|**Data Params**     |none                                                     
                                                     |
-+--------------------+--------------------------------------------------------------------------------------------------------------+
-|**Success Response**| [{"value": "*value*", "type": "*type*", 
"expiration_time": "*time*", "flag": *flag*, "label": "*name*"},...] |
-+--------------------+--------------------------------------------------------------------------------------------------------------+
-|**Error Response**  |{"error":"*error_desc*"}                                 
                                                     |
-+--------------------+--------------------------------------------------------------------------------------------------------------+
+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**|                                                         
|
-+--------------------+---------------------------------------------------------+
-|**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 11b2d29..63dd2e7 100644
--- a/source/identity.rst
+++ b/source/identity.rst
@@ -1,8 +1,8 @@
-GNUnet Identity API Service
-===========================
+Identity API Service
+====================
 
 Definition
-==========
+~~~~~~~~~~
 
 Variables in single quotes ``'...'`` can or must be changed according to your 
specific case.
 
@@ -25,7 +25,7 @@ Error Response
 
 An error response is sent in the JSON format: 
``{"error":"*error_description*"}``
 
-Numbers are added for references inside the documentation only.
+Following numbers are added for references inside the documentation only.
 
 Error descriptions are::
     
@@ -58,7 +58,7 @@ A response of a message has a HTTP response code. Usually, 
this code is 200 OK f
 ``d) 404 Not Found`` is always used when the error message is either ``2)``, 
``3)`` or ``4)``.
 
 Requests
-========
+~~~~~~~~
 
 GET Requests
 ------------
@@ -76,7 +76,7 @@ GET Requests
 
+--------------------+---------------------------------------------------------------+
 |**Success Response**|[{"pubkey":"*public_key*", "name":"*name*"},...]         
      |
 
+--------------------+---------------------------------------------------------------+
-|**Error Response**  | ``2) No identity found``                                
      |
+|**Error Response**  | {"error":"*error_desc*"} :sup:`2`                       
      |
 
+--------------------+---------------------------------------------------------------+
 |**Attention**       | The response in this request is an array!               
      |
 
+--------------------+---------------------------------------------------------------+
@@ -96,8 +96,7 @@ GET Requests
 
+--------------------+----------------------------------------------------------------+
 |**Success Response**|{"pubkey":"*public_key*", "name":"*name*"}               
       |
 
+--------------------+----------------------------------------------------------------+
-|**Error Response**  | | ``2) No identity found``; ``3) Missing identity 
public key`` |
-|                    | | or ``4) Missing identity name``                       
       |
+|**Error Response**  | {"error":"*error_desc*"} :sup:`2; 3 or 4`               
       |
 
+--------------------+----------------------------------------------------------------+
 
 |
@@ -115,7 +114,7 @@ GET Requests
 
+--------------------+---------------------------------------------------------------+
 |**Success Response**|{"pubkey":"*public_key*", "name":"*name*"}               
      |
 
+--------------------+---------------------------------------------------------------+
-|**Error Response**  | ``2) No identity found``; ``5) Missing subsystem name`` 
      |
+|**Error Response**  | {"error":"*error_desc*"} :sup:`2; 5`                    
      |
 
+--------------------+---------------------------------------------------------------+
 
 POST Request
@@ -134,7 +133,7 @@ POST Request
 
+--------------------+---------------------------------------------------------------+
 |**Success Response**| Response Code: :literal:` b) 201 Created`               
      |
 
+--------------------+---------------------------------------------------------------+
-|**Error Response**  | | ``6) No data``; ``7) Data invalid``                   
      |
+|**Error Response**  | | {"error":"*error_desc*"} :sup:`6; 7`                  
      |
 |                    | | *or*                                                  
      |
 |                    | | Response Code: ``e) 409 Conflict`` if name in use     
      |
 
+--------------------+---------------------------------------------------------------+
@@ -155,9 +154,7 @@ PUT Request
 
+--------------------+----------------------------------------------------------------+
 |**Success Response**| Response Code: :literal:`c) 204 No Content`             
       |
 
+--------------------+----------------------------------------------------------------+
-|**Error Response**  | | ``2) No identity found``; ``3) Missing identity 
public key`` |
-|                    | | or ``4) Missing identity name``; ``6) No data``;      
       |
-|                    | | ``7) Data invalid``; ``8) Rename failed``             
       |
+|**Error Response**  | | {"error":"*error_desc*"} :sup:`2; 3 or 4; 6; 7; 8`    
       |
 |                    | | *or*                                                  
       |
 |                    | | Response Code: :literal:`e) 409 Conflict` if newname 
in use  |
 
+--------------------+----------------------------------------------------------------+
@@ -177,9 +174,7 @@ PUT Request
 
+--------------------+----------------------------------------------------------------+
 |**Success Response**| Response Code: :literal:`c) 204 No Content`             
       |
 
+--------------------+----------------------------------------------------------------+
-|**Error Response**  | | ``2) No identity found``; ``4) Missing identity 
name``;      |
-|                    | | ``6) No data``; ``7) Data invalid``;                  
       |
-|                    | | ``9)  Setting subsystem failed``                      
       |
+|**Error Response**  | {"error":"*error_desc*"} :sup:`2; 4; 6; 7; 9`           
       |
 
+--------------------+----------------------------------------------------------------+
 
 DELETE Request
@@ -198,8 +193,7 @@ DELETE Request
 
+--------------------+----------------------------------------------------------------+
 |**Success Response**| Response Code: :literal:`c) 204 No Content`             
       |
 
+--------------------+----------------------------------------------------------------+
-|**Error Response**  | | ``2) No identity found``; ``3) Missing identity 
public key`` |
-|                    | | or ``4) Missing identity name``                       
       |
+|**Error Response**  | {"error":"*error_desc*"} :sup:`2; 3 or 4`               
       |
 
+--------------------+----------------------------------------------------------------+
 
 OPTIONS Request
diff --git a/source/index.rst b/source/index.rst
index 3f41bb9..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,22 +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
-   gns
    namestore
+   gns
+   peerinfo
 
 
 
-==================
-Indices and tables
-==================
+======
+Search
+======
 
-* :ref:`genindex`
-* :ref:`modindex`
 * :ref:`search`
diff --git a/source/namestore.rst b/source/namestore.rst
index cd2be42..85aba3a 100644
--- a/source/namestore.rst
+++ b/source/namestore.rst
@@ -1,34 +1,65 @@
-GNUnet Namestore API Service
-============================
+Namestore API Service
+=====================
+
+Definition
+~~~~~~~~~~
 
 Variables in single quotes ``'...'`` can or must be changed according to your 
specific case.
 
-Namestore communicates with GNS records:
+``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.
 
-``type`` is the type of the record, e.g. "PKEY" for private key. Possible 
types are listed in :ref:`ref-type`.
+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
+``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
+--------------
 
-``label`` is the name of the record. No duplicates are allowed.
+An error response is sent in the JSON format: 
``{"error":"*error_description*"}``
 
-Other variables used in the requests:
+Following numbers are added for references inside the documentation only.
 
-``error_desc`` is the description of the returned error.
+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
 
-``public_key`` is the public key of an identity.
+Error ``1)`` is always possible and is not listed in following requests.
 
-``name`` is the name of an identity.
+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 from all zones             
                                                                  |
+|**Title**           |Returns all namestore entries of default identity        
                                                                  |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
 |**URL**             |:literal:`/namestore`                                    
                                                                  |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
@@ -38,17 +69,17 @@ GET Request
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
 |**Data Params**     |none                                                     
                                                                  |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
-|**Success Response**|[{"value": "*value*", "type": "*type*", 
"expiration_time": "*time*", "flag": *flag*, "label": "*name*"},...]            
   |
+|**Success Response**|[{"value": "*value*", "record_type": "*type*", 
"expiration_time": "*time*", "flag": *flag*, "record_name": "*rname*"},...] |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
-|**Error Response**  |{"error":"*error_desc*"}                                 
                                                                  |
+|**Error Response**  | {"error":"*error_desc*"} :sup:`3; 4`                    
                                                                  |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
 
 |
 
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
-|**Title**           |Returns all namestore entries for one zone specified by 
its public key                                                     |
+|**Title**           |Returns all namestore entries for one zone specified by 
its name                                                           |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
-|**URL**             |:literal:`/namestore?pubkey='pubkey'`                    
                                                                  |
+|**URL**             |:literal:`/namestore/'name'`                             
                                                                  |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
 |**Method**          |**GET**                                                  
                                                                  |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
@@ -56,142 +87,102 @@ GET Request
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
 |**Data Params**     |none                                                     
                                                                  |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
-|**Success Response**|[{"value": "*value*", "type": "*type*", 
"expiration_time": "*time*", "flag": *flag*, "label": "*name*"},...]            
   |
+|**Success Response**|[{"value": "*value*", "record_type": "*type*", 
"expiration_time": "*time*", "flag": *flag*, "record_name": "*rname*"},...] |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
-|**Error Response**  |{"error":"*error_desc*"}                                 
                                                                  |
+|**Error Response**  | {"error":"*error_desc*"} :sup:`2; 4`                    
                                                                  |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
 
-|
+POST Request
+------------
 
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
-|**Title**           |Returns all namestore entries for one zone specified by 
its name                                                           |
+|**Title**           |Creates a namestore entry for default identity           
                                                                  |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
-|**URL**             |:literal:`/namestore?name='name'`                        
                                                                  |
+|**URL**             |:literal:`/namestore`                                    
                                                                  |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
-|**Method**          |**GET**                                                  
                                                                  |
+|**Method**          |**POST**                                                 
                                                                  |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
 |**URL Params**      |none                                                     
                                                                  |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
-|**Data Params**     |none                                                     
                                                                  |
+|**Data Params**     |{"value": "*value*", "record_type": "*type*", 
"expiration_time": "*time*", "flag": *flag*, "record_name": "*rname*"}       |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
-|**Success Response**|[{"value": "*value*", "type": "*type*", 
"expiration_time": "*time*", "flag": *flag*, "label": "*name*"},...]            
   |
+|**Success Response**|Response Code: :literal:`204` (No Content)               
                                                                  |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
-|**Error Response**  |{"error":"*error_desc*"}                                 
                                                                  |
+|**Error Response**  | {"error":"*error_desc*"} :sup:`3; 4; 5; 6; 7`           
                                                                  |
 
+--------------------+---------------------------------------------------------------------------------------------------------------------------+
 
-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)              
                                             |
-+--------------------+------------------------------------------------------------------------------------------------------+
-
 |
 
-+--------------------+------------------------------------------------------------------------------------------------------+
-|**Title**           |Creates a namestore entry for one zone specified by its 
public key                                    |
-+--------------------+------------------------------------------------------------------------------------------------------+
-|**URL**             |:literal:`/namestore?pubkey='pubkey'`                    
                                             |
-+--------------------+------------------------------------------------------------------------------------------------------+
-|**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)              
                                             |
-+--------------------+------------------------------------------------------------------------------------------------------+
-
-|
-
-+--------------------+------------------------------------------------------------------------------------------------------+
-|**Title**           |Creates a namestore entry for one zone specified by its 
name                                          |
-+--------------------+------------------------------------------------------------------------------------------------------+
-|**URL**             |:literal:`/namestore?name='name'`                        
                                             |
-+--------------------+------------------------------------------------------------------------------------------------------+
-|**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)              
                                             |
-+--------------------+------------------------------------------------------------------------------------------------------+
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**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                   |
-+--------------------+----------------------------------------------------+
-|**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*"}                           |
-+--------------------+----------------------------------------------------+
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+| **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?label='label'&pubkey='pubkey'` |
-+--------------------+----------------------------------------------------+
-|**Method**          | **DELETE**                                         |
-+--------------------+----------------------------------------------------+
-|**URL Params**      | none                                               |
-+--------------------+----------------------------------------------------+
-|**Data Params**     | none                                               |
-+--------------------+----------------------------------------------------+
-|**Success Response**| Response Code: :literal:`204` (No Content)         |
-+--------------------+----------------------------------------------------+
-|**Error Response**  | {"error":"*error_desc*"}                           |
-+--------------------+----------------------------------------------------+
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+| **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**          | Deletes specific namestore entry in specific zone  |
-+--------------------+----------------------------------------------------+
-|**URL**             |:literal:`/namestore?label='label'&name='name'`     |
-+--------------------+----------------------------------------------------+
-|**Method**          | **DELETE**                                         |
-+--------------------+----------------------------------------------------+
-|**URL Params**      | none                                               |
-+--------------------+----------------------------------------------------+
-|**Data Params**     | none                                               |
-+--------------------+----------------------------------------------------+
-|**Success Response**| Response Code: :literal:`204` (No Content)         |
-+--------------------+----------------------------------------------------+
-|**Error Response**  | {"error":"*error_desc*"}                           |
-+--------------------+----------------------------------------------------+
++--------------------+---------------------------------------------------------------------------------------------------------------------------+
+|**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]