Skip to content

User Module API

The User Module is implemented with the plg_jbackend_user plugin. It provides functions related to Joomla users and ACL. Here is the list of supported methods.

User login

Request parameters

text
action=post
module=user
resource=login
username=<username>
password=<password>

Example

text
<end-point>?action=post&module=user&resource=login&username=<username>&password=<password>

Example (REST format)

text
<end-point>/post/user/login?username=<username>&password=<password>

Response

json
{
    "status": "ok",
    "userid": <userid>,
    "username": "<username>",
    "session_id": "<session_id>"
}

To avoid to pass credentials in clear it is recommended to expose the endpoint over HTTPS, and to pass username and password as POST variables (it is supported out-of-the-box), or enabling JSON Login option and using a POST method with a JSON payload.

User logout

Request parameters

text
action=get
module=user
resource=logout

Example

text
<end-point>?action=get&module=user&resource=logout

Example (REST format)

text
<end-point>/get/user/logout

Response

json
{
    "status": "ok"
}

User registration

Request parameters

text
action=post
module=user
resource=register
username=<username>
password=<password>
email=<email>
firstname=<firstname>
lastname=<lastname>

Example

text
<end-point>?action=post&module=user&resource=register&username=<username>&password=<password>&email=<email>&firstname=<firstname>&lastname=<lastname>

Example (REST format)

text
<end-point>/post/user/register?username=<username>&password=<password>&email=<email>&firstname=<firstname>&lastname=<lastname>

Response

json
{
    "status": "ok"
}

To avoid to pass sensible data in clear it is recommended to expose the endpoint over HTTPS, and to pass variables using POST method (it is supported out-of-the-box), or enabling JSON Register option and using a POST method with a JSON payload.

User remind

Sends an email to the user's account with a password remind link.

Request parameters

text
action=get
module=user
resource=remind
email=<email>

Example

text
<end-point>?action=get&module=user&resource=remind

Example (REST format)

text
<end-point>/get/user/remind

Response

json
{
    "status": "ok"
}

User reset

Sends an email to the user's account with a password reset link.

Request parameters

text
action=get
module=user
resource=reset
email=<email>

Example

text
<end-point>?action=get&module=user&resource=reset

Example (REST format)

text
<end-point>/get/user/reset

Response

json
{
    "status": "ok"
}

User profile

Request parameters

text
action=get
module=user
resource=profile

Example

text
<end-point>?action=get&module=user&resource=profile

Example (REST format)

text
<end-point>/get/user/profile

Response

json
{
    "status": "ok",
    "fields": [
        {
            "id": "<id>",
            "title": "<title>",
            "name": "<name>",
            "language": "<language>",
            "type": "<type>",
            "default_value": "<default value>",
            "context": "<context>",
            "group_id": "<group id>",
            "label": "<label>",
            "description": "<description>",
            "required": "<required>",
            "language_title": "<language title>",
            "language_image": "<language image>",
            "group_title": "<group title>",
            "value": "<value>",
            "rawvalue": "<raw value>"
        },
        ...
    ],
    "_errors": [<_errors>],
    "groups": {
        "<groupid>": "<groupid>"
        ...
    },
    "id": "<id>",
    "name": "<name>",
    "username": "<username>",
    "email": "<email>",
    "block": "<block>",
    "sendEmail": "<sendEmail>",
    "registerDate": "<registerDate>",
    "lastvisitDate": "<lastvisitDate>",
    "activation": "<activation>",
    "params": {
        "admin_style": "<admin_style>",
        "admin_language": "<admin_language>",
        "language": "<language>",
        "editor": "<editor>",
        "helpsite": "<helpsite>",
        "timezone": "<timezone>"
    },
    "lastResetTime": "<lastResetTime>",
    "resetCount": "<resetCount>",
    "otpKey": "<otpKey>",
    "otep": "<otep>",
    "requireReset": "<requireReset>",
    "tags": {
        "typeAlias": <typeAlias>,
        "tags": "<tags>"
    }
}

It is possible to filter fields in the response just specifying the field list in the Required fields option.

User profile update

Allows to update the user profile (user must be authenticated). The requests must use the POST method with a JSON payload.

Request parameters

text
action=put
module=user
resource=profile

Example

text
POST <end-point>?action=put&module=user&resource=profile

Example (REST format)

text
POST <end-point>/put/user/profile

JSON payload data:

json
{
    "name": "<name>",
    "username": "<username>",
    "password": "<password>",
    "email": "<email>",
    "profile": {
        "city": "<city>"
        ...
    },
    "com_fields": {
        "field-1": "<value 1>",
        "field-2": "<value 2>"
        ...
    }
}

Response

json
{
    "status": "ok"
}

It is possible to specify any supported field in the payload, but the following fields are mandatory for each request: name, username, password, email

User status

Allows to check the current status of the user (guest or logged in), and provides some additional information.

Request parameters

text
action=get
module=user
resource=status

Example

text
<end-point>?action=get&module=user&resource=status

Example (REST format)

text
<end-point>/get/user/status

Response

json
{
    "status": "ok",
    "is_guest": <0 or 1>,
    "user_id": "<user_id>",
    "session_id": "<session_id>",
    "session_expire": <session_expire>
}

Plugin Settings

jBackend User Plugin Settings

The following options are available for user plugin:

OptionDescription
Auto activateAutomatically activate users on registration and skip any notification email.
Extended auth requestProcess register, remind and reset as an authentication request (i.e. these requests can bypass the access restrictions on the endpoint).
Extended fieldsEnable support for additional fields in the registration.
External librariesList of paths (relative to JPATH_SITE) of external libraries to load in the registration (one path each row).
Required fieldsList of fields to include in the response for profile requests (when blank it returns all fields). Fields must be separated by commas and square brackets for nested fields (e.g. id,name,username,profile[city,region,country]).
JSON LoginEnable JSON payload on login action.
JSON RegisterEnable JSON payload on register action.
Enable session idWhen enabled it overrides cookie based session with session_id parameter. This is useful when it is not possible to rely on cookie based session. This parameter can be passed as GET/POST param or as JSON field when JSON payload is enabled for the current request.