peerinfo.rst (6109B)
1 Peerinfo 2 ======== 3 4 Definition 5 ~~~~~~~~~~ 6 7 Variables in single quotes ``'...'`` can or must be changed according to your specific case. 8 9 ``friend`` is to enable the optional friend information. It is either ``yes`` or can be left away. 10 11 Peer 12 ---- 13 14 A peer consists of an ``identifier`` and one or more ``addresses`` with ``expiration dates``. 15 16 Peerinfo Response 17 ----------------- 18 19 The response of the peerinfo API is a JSON Array: 20 21 .. code-block:: text 22 23 [ 24 { 25 "peer":'identifier', 26 "array": [ 27 { 28 "address":'peer_address', 29 "expires":'address_expiration' 30 }, 31 ... 32 ] 33 }, 34 ... 35 ] 36 37 ``ìdentifier`` is a 52-character, alphanumeric identifier of the peer. 38 39 ``peer_address`` is one URI as string. 40 41 ``address_expiration`` is the date, when the address expires, e.g. "Wed Aug 1 10:00:00 2018". 42 43 44 Error Response 45 -------------- 46 47 An error response is sent in the JSON format: ``{"error":"*error_description*"}`` 48 49 Following numbers are added for references inside the documentation only. 50 51 Error descriptions are:: 52 53 Nr. Error Description - Explanation 54 1) Unknown Error - Error is not specified 55 2) No peers found - Peers were not found, this is combined with the HTTP Error Code 404 Not Found 56 57 Error ``1)`` is always possible and is not listed in following requests. 58 59 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. 60 61 Requests 62 ~~~~~~~~ 63 64 GET Request 65 ------------ 66 67 +--------------------+---------------------------------------------------------------------------------------------------------------------------+ 68 |**Title** | Returns all peers and resolves their addresses | 69 +--------------------+---------------------------------------------------------------------------------------------------------------------------+ 70 |**URL** | :literal:`/peerinfo` | 71 +--------------------+---------------------------------------------------------------------------------------------------------------------------+ 72 |**Method** | **GET** | 73 +--------------------+---------------------------------------------------------------------------------------------------------------------------+ 74 |**URL Params** | ``?friend='friend'`` optional | 75 +--------------------+---------------------------------------------------------------------------------------------------------------------------+ 76 |**Data Params** | none | 77 +--------------------+---------------------------------------------------------------------------------------------------------------------------+ 78 |**Success Response**| Peerinfo Response *or* Response Code: ``500 Internal Server Error`` | 79 +--------------------+---------------------------------------------------------------------------------------------------------------------------+ 80 |**Error Response** | {"error":"*error_desc*"} :sup:`2` | 81 +--------------------+---------------------------------------------------------------------------------------------------------------------------+ 82 83 OPTIONS Request 84 --------------- 85 86 +--------------------+---------------------------------------------------------------------------------------------------------------------------+ 87 |**Title** |Gets request options | 88 +--------------------+---------------------------------------------------------------------------------------------------------------------------+ 89 |**URL** |:literal:`/peerinfo` | 90 +--------------------+---------------------------------------------------------------------------------------------------------------------------+ 91 |**Method** |**OPTIONS** | 92 +--------------------+---------------------------------------------------------------------------------------------------------------------------+ 93 |**URL Params** |none | 94 +--------------------+---------------------------------------------------------------------------------------------------------------------------+ 95 |**Data Params** |none | 96 +--------------------+---------------------------------------------------------------------------------------------------------------------------+ 97 |**Success Response**| | 98 +--------------------+---------------------------------------------------------------------------------------------------------------------------+ 99 |**Error Response** |none | 100 +--------------------+---------------------------------------------------------------------------------------------------------------------------+