matrixtool client json - Perform a direct JSON request


   $ matrixtool client -u json /_matrix/client/r0/publicRooms


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.


--method, -m

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


For example, directly querying your user profile data:

   $ matrixtool client -u json \
       "avatar_url": "mxc://",
       "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 json \
       /_matrix/client/r0/profile/ \
       '{"displayname":"Mr. Example"}'


Paul Evans <>