2121 [--logfile LOGFILE] [--syslog] [--syslog-local [0-7]]
2222 [--disable-stderr] [--datadir DATADIR]
2323 [--maxpeers MAXPEERS] [--wallet WALLET] [--host HOST]
24- [--extended-rpc]
2524
2625 optional arguments:
2726 -h, --help show this help message and exit
3029 --wallet WALLET Open wallet. Will allow you to use methods that
3130 require an open wallet
3231 --host HOST Hostname ( for example 127.0.0.1)
33- --extended-rpc Use extended json-rpc api
3432
3533 Network options:
3634 --mainnet Use MainNet
5250 Value must be between 0 and 7 (e.g. 0 for 'local0').
5351 --disable-stderr Disable stderr logger
5452
53+ API Server Plugins
54+ """"""""""""""""""
55+
56+ Default API server operation is defined in neo/Settings.py under ``DEFAULT_RPC_SERVER `` and ``DEFAULT_REST_SERVER ``. Custom API server operation should be defined in the specific ``protocol.<title>.json `` being utilized. For example, to use the ExtendedJsonRpcApi update the "RPCServer" value in the corresponding ``protocol.<title>.json `` to
57+
58+ ::
59+
60+ "RPCServer": "neo.api.JSONRPC.ExtendedJsonRpcApi.ExtendedJsonRpcApi"
61+
62+ **NOTE: ** Remember to run ``python setup.py install `` after making any changes to a ``protocol.<title>.json ``, so the changes take effect.
63+
5564Default JSON-RPC Command List
5665-----------------------------
5766
@@ -224,13 +233,13 @@ Request using ``curl``:
224233
225234::
226235
227- curl -X POST http://seed3.neo.org :10332 -H 'Content-Type: application/json' -d '{ "jsonrpc": "2.0", "id": 1, "method": "getblockcount", "params": [] }'
236+ curl -X POST http://108.252.121.18 :10332 -H 'Content-Type: application/json' -d '{ "jsonrpc": "2.0", "id": 1, "method": "getblockcount", "params": [] }'
228237
229238After sending the request, you will get the following response:
230239
231240::
232241
233- {"jsonrpc":"2.0","id":1,"result":2829911 }
242+ {"jsonrpc":"2.0","id":1,"result":2986181 }
234243
235244Script Request Example
236245""""""""""""""""""""""
@@ -241,7 +250,7 @@ Script Request Example
241250 import json
242251
243252
244- url = "http://seed3.neo.org :10332"
253+ url = "http://108.252.121.18 :10332"
245254 body = {"jsonrpc": "2.0", "id": 1, "method": "getblockcount", "params": []}
246255 res = requests.post(url, json=body)
247256 res = res.json()
@@ -255,21 +264,49 @@ After running the script, you will receive the following response:
255264 {
256265 "jsonrpc": "2.0",
257266 "id": 1,
258- "result": 2829945
267+ "result": 2986181
259268 }
260269
261- GET Request Example
262- -------------------
270+ GET Request Examples
271+ --------------------
263272
264- Using A Script
265- """"""""""""""
273+ Web Browser Request Example
274+ """""""""""""""""""""""""""
275+
276+ ::
277+
278+ http://108.252.121.18:10332/?jsonrpc=2.0&id=1&method=getblockcount¶ms=[]
279+
280+ After executing the query in your address bar, you will receive the following response:
281+
282+ ::
283+
284+ {"jsonrpc": "2.0", "id": "1", "result": 2986181}
285+
286+ Bash Request Example
287+ """"""""""""""""""""
288+
289+ Request using ``curl ``:
290+
291+ ::
292+
293+ curl "http://108.252.121.18:10332/?jsonrpc=2.0&id=1&method=getblockcount¶ms=[]"
294+
295+ After sending the request, you will get the following response:
296+
297+ ::
298+
299+ {"jsonrpc": "2.0", "id": "1", "result": 2986181}
300+
301+ Script Request Example
302+ """"""""""""""""""""""
266303
267304::
268305
269306 import requests
270307 import json
271308
272- res = requests.get('http://seed3.neo.org :10332?jsonrpc=2.0&id=1&method=getblockcount¶ms=[]')
309+ res = requests.get('http://108.252.121.18 :10332/ ?jsonrpc=2.0&id=1&method=getblockcount¶ms=[]')
273310 res = res.json()
274311
275312 print("{}".format(json.dumps(res, indent=4)))
@@ -281,14 +318,47 @@ After running the script, you will receive the following response:
281318 {
282319 "jsonrpc": "2.0",
283320 "id": 1,
284- "result": 2829945
321+ "result": 2986181
285322 }
286323
324+ OPTIONS Request Example
325+ -----------------------
326+
327+ OPTIONS requests are useful for determining the supported HTTP methods and JSON-RPC server type.
328+
329+ * Supported HTTP methods include "GET" and "POST"
330+
331+ * JSON-RPC server types include "default" and "extended-rpc"
332+
333+
334+ Bash Request Example
335+ """"""""""""""""""""
336+
337+ Request using ``curl ``:
338+
339+ ::
340+
341+ curl -X OPTIONS 'http://108.252.121.18:10332'
342+
343+ Depending on the type of server, you could receive
344+
345+ ::
346+
347+ {"supported HTTP methods": ["GET", "POST"], "JSON-RPC server type": "default"}
348+
349+ or
350+
351+ ::
352+
353+ {"supported HTTP methods": ["GET", "POST"], "JSON-RPC server type": "extended-rpc"}
354+
287355Using Multi-Request in JSON-RPC
288356-------------------------------
289357
290358neo-python supports multiple requests in one call by detecting list input.
291359
360+ **NOTE: ** "GET" requests do not support multiple requests in one call
361+
292362Example
293363"""""""
294364
0 commit comments