Package: jsonrpcake
JSONRPCake is acommand line JSON-RPC clientthat wraps the jsonrpc-ns library.
It is a fork ofHTTPiewritten byJakub Roztocil.
Its goal is to make CLI interaction
withJSON-RPC2.0 services ashuman-friendlyas possible. It provides a
simplejsonrpccommand that allows for sending arbitraryJSON-RPCrequests using a
simple and natural syntax, and displays colorized responses. JSONRPCake can be used
fortesting, debugging, and generallyinteractingwithJSON-RPCservers.JSONRPCake is written in Python, and under the hood it uses thejsonrpc-nsandPygmentslibraries.Table of ContentsMain FeaturesInstallationUsageJSON-RPC Address and PortJSON-RPC MethodParametersRedirected InputTerminal OutputRedirected OutputAuthorsLicenceMain FeaturesExpressive and intuitive syntaxFormatted and colorized terminal outputBuilt-in JSON supportArbitrary request dataInstallationThe lateststable versionof JSONRPCake can always be installed or updated
to viapip:$pipinstall--upgradejsonrpcakeUsageHello World:$jsonrpcexample.org:3000helloSynopsis:$jsonrpcADDRESS:PORTMETHOD[PARAMETER[PARAMETER[...]]]See alsojsonrpc--help.ExamplesJSONparams:$jsonrpcexample.org:3000updatename=Johnuid:=1234JSON-RPC Address and PortThe address and port are separated by a ‘:’.
The TCP port isrequired. When the addressomitted,
the default address islocalhost.$jsonrpc:3000usersIs equivalent to:$jsonrpclocalhost:3000usersJSON-RPC MethodThe name of the JSON-RPC method comes right after the address and port:$jsonrpcexample.org:3000usersTheMETHODargument isrequired.ParametersJSON parameters are key/value pairs specified after the`METHOD`.
The parameter type is distinguished only by the separator used::,=,:=,==,@,=@, and:=@. The ones with an@expect a file path as value.Item TypeDescriptionData Fieldsfield=value,Request data fields to be serialized as a JSON
object (default).Raw JSON fieldsfield:=json,field:=@file.jsonUseful when sending JSON and one or
more fields need to be aBoolean,Number,
nestedObject, or anArray,  e.g.,meals:='["ham","spam"]'orpies:=[1,2,3](note the quotes).Redirected InputA universal method for passing request parameters is through redirectedstdin(standard input). Such data is buffered and then with no further processing
used as the request body. There are multiple useful ways to use piping:Redirect from a file:$jsonrpcexample.com:7080add.user<person.jsonYou can useechofor simple data:$echo'{"uid": 1234, "name": "John"}'|jsonrpcexample.com:3000update.userinfoYou can usecatto enter multiline data on the terminal:$cat|jsonrpcexample.com:3000update<paste>^DTo prevent JSONRPCake from readingstdindata you can use the--ignore-stdinoption.Terminal OutputJSONRPCake does several things by default in order to make its terminal output
easy to read.Colors and FormattingSyntax highlighting is applied to the response (where it makes
sense). You can choose your prefered color scheme via the--styleoption
if you don’t like the default one (see$ jsonrpc--helpfor the possible
values).Also, the following formatting is applied:JSON data is indented, sorted by keys, and unicode escapes are converted
to the characters they represent.One of these options can be used to control output processing:--pretty=allApply both colors and formatting.
Default for terminal output.--pretty=colorsApply colors.--pretty=formatApply formatting.--pretty=noneDisables output processing.
Default for redirected output.Redirected OutputJSONRPCake usesdifferent defaultsfor redirected output than forterminal output:Formatting and colors aren’t applied (unless--prettyis specified).Only the response message is printed.Force colorizing and formatting, and show both the request and the response inlesspager:$jsonrpc--pretty=all--verboseexample.org:7080info|less-RThe-Rflag tellslessto interpret color escape sequences included
JSONRPCake`s output.AuthorsForked byJoe HillenbrandJakub RoztocilcreatedHTTPieandthese fine peoplehave contributed.LicencePlease seeLICENSE.