The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

JSON::Shell - an interactive shell for performing JSON and JSON-RPC requests

SYNOPSIS

    $ bin/jsonshell

    JSON::Shell 1.0
    www.example.com/json-rpc-demo$ post '{ "id": 1, "method": "echoObject", "params": { "o": [ "YAY JSON~" ] } }'
    REQUEST: $VAR1 = {
              'params' => {
                            'o' => [
                                     'YAY JSON~'
                                   ]
                          },
              'method' => 'echoObject',
              'id' => '1'
            };

    RESPONSE: $VAR1 = {
              'id' => '1',
              'result' => [
                            'YAY JSON~'
                          ]
            };

    www.example.com/json-rpc-demo$ 

 

DESCRIPTION

JSON::Shell provides an interactive debugger and workbench for JSON based web services.

USAGE

Typically you would use JSON::Shell through the provided bin/jsonshell script. See Shell::Base for the options available to use JSON::Shell programmatically.

COMMANDS

endpoint <URL>

Defines the JSON endpoint to which posts will be issued.

parse <JSON code>

Evaluates the given JSON code into a data structure, displaying it if successful. Use this command to check if your JSON syntax is correct.

post <JSON code>

Evaluates the given JSON code to check its validity, then posts it to the current endpoint, displaying the JSON response.

post <JSON-RPC method> [<JSON-RPC request ID>] <JSON code>

Evaluates the given JSON code to check its validity, then posts it to the current endpoint as a JSON-RPC request of the given method. If a JSON-RPC request ID is not given, one is generated randomly and used in the request.

response

Displays the content of the last HTTP response in your configured pager. Use this to diagnose malformed responses, as some environments may not return especially egregious errors in JSON format.

DIAGNOSTICS

I don't know what you mean by '%s'.

You issued the given command in the shell, but that command is not defined by JSON::Shell. Perhaps you misspelled one of the defined commands.

JSON error: %s

While parsing a JSON string using the parse command, JSON::Shell encountered the given error. Perhaps the string you asked to parse was not correctly formed JSON.

I don't know what you want to post with that number number of parameters.

You specified an undefined number of parameters to post. Only posts with one parameter (a JSON string), two parameters (a JSON-RPC method and params hash), and three parameters (a JSON-RPC method, invocation ID, and params hash) are supported. Perhaps you didn't enclose a command parameter containing spaces in quotes.

No endpoint defined; see 'endpoint'

You attempted to issue a post or login without defining an endpoint first. An endpoint URL is required to send JSON requests. Perhaps your endpoint URL was mistyped, or your .jsonshellrc file is misplaced or malformed.

JSON error in request: %s

The request you asked to post was not valid JSON, for the given reason. Perhaps you mistyped it, or didn't enclose your request in quotes.

HTTP error: %s

The HTTP request just issued failed, with the given status line. Perhaps the endpoint URL is incorrect, or there is an actual error with the server. You might also use the response command to view the body of the response.

JSON error in response: %s

The attempt to parse your request's response as JSON failed, for the given reason. Perhaps your endpoint is incorrectly pointing at an XML or HTML resource, or your request produced a server error in XML or HTML, or the server produced malformed JSON. Use the response command to view the unparsed body of the response.

CONFIGURATION AND ENVIRONMENT

JSON::Shell can be configured with a .jsonshellrc file in the directory from which jsonshell is invoked. Options available in the .jsonshellrc file are:

endpoint = <URL>

This option defines the endpoint to which JSON requests are posted.

JSON::Shell also performs web requests using the file .jsonshell_cookies in the directory from which jsonshell is invoked for an LWP cookie jar. If the service you're using requires you to authenticate with cookies, you can place those cookies in the .jsonshell_cookies file. See HTTP::Cookies for information on LWP cookie jar files.

DEPENDENCIES

Shell::Base
JSON

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to bug-json-shell@rt.cpan.org, or through the web interface at http://rt.cpan.org.

SEE ALSO

Shell::Base
JSON
JSON-RPC <http://json-rpc.org/>
HTTP::Cookies

AUTHOR

Mark Paschal <mark@sixapart.com>

LICENCE AND COPYRIGHT

Copyright 2005-2006 Six Apart, Ltd. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.