<commit_before>.. TODO kegan
  Room config (specifically: message history,
  public rooms). /register seems super simplistic compared to /login, maybe it
  would be better if /register used the same technique as /login? /register should
  be "user" not "user_id".

How to use the client-server API
================================

.. NOTE::
  The git version of this document is ``{{git_version}}``

This guide focuses on how the client-server APIs *provided by the reference 
home server* can be used. Since this is specific to a home server 
implementation, there may be variations in relation to registering/logging in
which are not covered in extensive detail in this guide.

If you haven't already, get a home server up and running on 
``http://localhost:8008``.


Accounts
========
Before you can send and receive messages, you must **register** for an account. 
If you already have an account, you must **login** into it.

.. NOTE::
  `Try out the fiddle`__

  .. __: http://jsfiddle.net/gh/get/jquery/1.8.3/matrix-org/matrix-doc/tree/master/supporting-docs/howtos/jsfiddles/register_login

Registration
------------
The aim of registration is to get a user ID and access token which you will need
when accessing other APIs::

    curl -XPOST -d '{"user":"example", "password":"<PASSWORD>", "type":"m.login.password"}' "http://localhost:8008/_matrix/client/api/v1/register"

    {
        "access_token": "<KEY>", 
        "home_server": "localhost", 
        "user_id": "@example:localhost"
    }

NB: If a ``user`` is not specified, one will be randomly generated for you. 
If you do not specify a ``password``, you will be unable to login to the account<commit_msg>Test break RST<commit_after>.. TODO kegan
  Room config (specifically: message history,
  public rooms). /register seems super simplistic compared to /login, maybe it
  would be better if /register used the same technique as /login? /register should
  be "user" not "user_id".

How to use the client-server API
================================

.. NOTE::
  The git version of this document is ``{{git_version}}``

This guide focuses on how the client-server APIs *provided by the reference 
home server* can be used. Since this is specific to a home server 
implementation, there may be variations in relation to registering/logging in
which are not covered in `extensive`_ detail in this guide.

If you haven't already, get a home server up and running on 
``http://localhost:8008``.


Accounts
========
Before you can send and receive messages, you must **register** for an account. 
If you already have an account, you must **login** into it.

.. NOTE::
  `Try out the fiddle`__

  .. __: http://jsfiddle.net/gh/get/jquery/1.8.3/matrix-org/matrix-doc/tree/master/supporting-docs/howtos/jsfiddles/register_login

Registration
------------
The aim of registration is to get a user ID and access token which you will need
when accessing other APIs::

    curl -XPOST -d '{"user":"example", "password":"<PASSWORD>", "type":"m.login.password"}' "http://localhost:8008/_matrix/client/api/v1/register"

    {
        "access_token": "<KEY>", 
        "home_server": "localhost", 
        "user_id": "@example:localhost"
    }

NB: If a ``user`` is not specified, one will be randomly generated for you. 
If you do not specify a ``password``, you will be unable to login to the account
{'fraction_non_alphanumeric': 0.132896305125149, 'fraction_numerical': 0.007151370679380214, 'mean_word_length': 3.7617021276595746, 'pattern_counts': {'":': 12, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3857066', 'n_tokens_mistral': 968, 'n_tokens_neox': 923, 'n_words': 411}