Changes between Version 1 and Version 2 of i2pcontrol


Ignore:
Timestamp:
Jan 20, 2016 9:10:30 PM (4 years ago)
Author:
tuna
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • i2pcontrol

    v1 v2  
    11This page will outline the API2 for i2pcontrol
    22
    3 == Developer headsup!==
    4  * The "token" parameter in requests have been renamed from "Token" to the all lower case "token". The reason for this is to make the API as intuitive and predictable as possible.
     3= Developer headsup! =
     4 * All RPC paramters will now be lower case. This *will* break backwards compatibility with API1 implementations. The reasons for this is to provide users of >=API2 with simplest most coherent possible API.
    55
    6 == API 2 ==
     6= API 2 =
    77
    88
     
    1313  "params": {
    1414    "token": "**auth_token**"
    15     "method_argument": **method_argument_value**,
     15    "method_param": **method_parameter_value**,
    1616
    1717  },
     
    2929  * **method_name** - The method name is the name of the RPC that is being invoked
    3030  * **auth_token** - This is the session authentication token, it needs to be supplied with every RPC except for the 'authenticate' call
    31   * **method_argument_value** - This is the method argument. It is used to offer a different flavors of a method.  Like 'get', 'set' and flavors like that.
     31  * **method_parameter_value** - This is the method parameter. It is used to offer a different flavors of a method.  Like 'get', 'set' and flavors like that.
    3232  * **result_value** - This is the value that RPC returns. Its type and contents depends on the method and which method
    3333
    34 === Prefixes ===
     34== Prefixes ==
    3535
    3636The naming for will be done similar to how it's done in CSS, with vendor prefixes for the different API implementations (i2p, kovri, i2pd).
     
    4646If is implemented by all implementations it can be moved under the umbrella of the next API version
    4747
    48 === Methods ===
    4948
    50  * authenticate
    51    * *Argument:*  {password [string]
    52      * returns:
     49== Method reading guide ==
     50
     51
     52 * '''rpc.method'''
     53   * '''''parameter''''' [type of parameter]:  [null], [nubmer], [string], [boolean], [array] or [object]. [object] being a {key:value} map.
    5354{{{
     55[string]
     56"return_value" // This is the value returned by the RPC call
     57}}}
     58
     59
     60== Methods ==
     61
     62 * '''authenticate''' - Given that a correct password is provided, this method provides you with a token for further access and a list of supported API levels.
     63   * '''''password''''' [string]:  The password for this i2pcontrol implementation
     64{{{
     65[object]
    5466{
    55   "token" : [string],
    56   "api" : [int]
     67  "token" : [string], // The token to be used be supplied with all other RPC methods
     68  "api" : [[int],[int], ...]  // A list of supported API levels.
    5769}
    5870}}}
     71
     72
     73 * '''stats.advanced''' - This method provides access to all stats kept within the instance.
     74   * '''''get''''' [string]:  Name of the advanced stat to be provided
     75   * ''Optional:'' '''''period''''' [number]:  The period for the requested stat
     76{{{
     77[number]
     780.0
     79}}}
     80
     81 * '''stats.????''' - Given that a correct password is provided, this method provides you with a token for further access and a list of supported API levels.
     82   * '''''get''''' [null]: This parameter does not need to be set.
     83{{{
     84[number]
     850.0
     86}}}
     87
     88
     89 * '''i2pcontrol.address''' - Get/Set the ip address that i2pcontrol listens to.
     90   * '''''get''''' [nil]: This parameter does not need to be set.
     91{{{
     92[string]
     93"0.0.0.0"
     94}}}
     95   * '''''set''''' [string]: This will be an ip address like "0.0.0.0" or "192.168.0.1"
     96{{{
     97[nil]
     98}}}
     99
     100 * '''i2pcontrol.password''' - Change the i2pcontrol password.
     101   * '''''set''''' [string]: This parameter does not need to be set.
     102{{{
     103[nil]
     104}}}
     105
     106 * '''i2pcontrol.port''' - Get/Set the port that i2pcontrol listens to.
     107   * '''''get''''' [nil]: This parameter does not need to be set.
     108{{{
     109[number]
     1107650
     111}}}
     112   * '''''set''''' [number]: Change the port that i2pcontrol listens to to this port
     113{{{
     114[nil]
     115}}}
     116