NAME

matrixtool client json - Perform a direct JSON request

SYNOPSIS

$ matrixtool client -u @me:example.com json /_matrix/client/r0/publicRooms

DESCRIPTION

This command performs a direct low-level HTTP request to a Matrix homeserver. The server name part of the URL is automatically inferred from the given user ID; the PATH commandline argument only requires the path and optional query parameters. If an access token is known for the user (see matrixtool client login) then it is automatically added to the query parameters as well.

An optional second argument, DATA, may be provided. If so, this should contain a JSON encoding of data to supply with the request, turning it into a PUT request. If no data is supplied, then a GET request is performed instead.

The resulting JSON data from the homeserver is parsed and re-printed in a more human-readable form to standard output. Linefeeds and indentation whitespace are used to increase readability.

OPTIONS

--method, -m

Use a different HTTP method. If not specified, GET or PUT will be performed, depending on whether the DATA argument was supplied.

EXAMPLES

For example, directly querying your user profile data:

$ matrixtool client -u @me:example.com json \
    /_matrix/client/r0/profile/@me:example.com
{
    "avatar_url": "mxc://example.com/aBcDeFgHiJ...",
    "displayname": "Mr Example",
}

By supplying a second parameter containing JSON-encoded data, we can perform a PUT request to update the displayname:

$ matrixtool client -u @me:example.com json \
    /_matrix/client/r0/profile/@me:example.com/displayname \
    '{"displayname":"Mr. Example"}'
{}

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>