py-restclient / docs / console.txt

The default branch has multiple heads

.. _console:

Console client
==============

A console client is available with py-restkit. It allow you to perform any HTTP
 request you need in console.

Examples :
----------
create a paste in Friendpaste from command line:

.. code-block:: bash

    benoitc@pollen:/tmp$ restcli -H "Accept:application/json" -H "Content-Type: application/json" http://friendpaste.com POST - < test.json 
    {"url": "http://friendpaste.com/1Po5tOC012QeFYOS3b3RaA", "rev": "373163383163", "ok": true, "id": "1Po5tOC012QeFYOS3b3RaA"}

This command send test.json file to Friendpaste and you get back the full url of paste in json result.

test.json file :

.. code-block:: javascript

    {
        "title":"I like to paste stuff",
        "snippet":"My own paste",
        "language":"text"
    }


Get your twitter status time line :

.. code-block:: bash

    benoitc@pollen:/tmp$ restcli http://XXXXXXX:XXXXXXX@twitter.com/statuses/user_timeline.json


Usage :
-------


restcli [options] url [METHOD] [filename]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -H HEADERS, --header=HEADERS
                        http string header in the form of Key:Value. For
                        example: "Accept: application/json"
  -i FILE, --input=FILE
                        the name of the file to read from
  -o OUTPUT, --output=OUTPUT
                        the name of the file to read from
  --proxy=PROXY         Full uri of proxy, ex:
                        http://username:password@proxy:port/
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.