The Content Module is implemented with the plg_jbackend_content plugin. It provides functions related to Joomla content (articles and categories). Here is the list of supported methods.
action=get module=content resource=categories rootid=<R> (optional) recursive=<true or 1> (optional) countitems=<true or 1> (optional)
<end-point>?action=get&module=content&resource=categories&rootid=<R>&recursive=<false>&countitems=<0>
<end-point>/get/content/categories?rootid=<R>
{ "status": "ok", "total": <T>, "categories": [ { "id": "<category id>", "title": "<category title>", "description": "<category description>", "parent_id": "<parent category id>", "numitems": <items count> }, ... { "id": "<category id>", "title": "<category title>", "description": "<category description>", "parent_id": "<parent category id>", "numitems": <items count> } ] }
If rootid is specified, starts to get subcategories from the specified category id instead of the root category. If recursive is true or 1, get categories and all subcategories, otherwise get only one level (default). If countitems is true or 1, return the number of articles of each category, otherwise do not return this information (default). Category id can be "root" for root node.
action=get module=content resource=categories id=<N>
<end-point>?action=get&module=content&resource=categories&id=<N>
<end-point>/get/content/categories/<N>
{ "status": "ok", "id": "<category id>", "title": "<category title>", "alias": "<category alias>", "description": "<category description>", "metadesc": "<meta description>", "metakey": "<meta keywords>", "metadata": { "page_title": "<meta title>", "author": "<meta author>", "robots": "<meta robots>" }, "language": "<language code>", "parent_id": "<category id>", "level": "<category level>", "numitems": "<N>" }
Language can be "*" if any. Category id can be "root" for root node.
action=get module=content resource=articles catid=<C> (optional) maxsubs=<S> (optional) featured=<F> (optional) limit=<L> (optional) offset=<O> (optional) orderby=<field> (optional) orderdir=<dir> (optional)
<end-point>?action=get&module=content&resource=articles&catid=<C>&maxsubs=<S>&featured=<F>&orderby=<id>
<end-point>/get/content/articles?catid=<C>&limit=<L>&offset=<O>
{ "status": "ok", "total": <total articles>, "limit": <pagination limit>, "offset": <pagination offset>, "pages_current": <current page>, "pages_total": <total pages>, "articles": [ { "id": "<article id>", "title": "<article title>", "alias": "<article alias>", "featured": "<featured>", "content": "<article content>", "catid": "<article category id>", "images": { "image_intro": "<image_url_for_intro>", "float_intro": "<float_side_for_intro>", "image_intro_alt": "<alt_text_for_intro>", "image_intro_caption": "<caption_for_intro>", "image_fulltext": "<image_url_for_fulltext>", "float_fulltext": "<float_side_for_fulltext>", "image_fulltext_alt": "<alt_text_for_fulltext>", "image_fulltext_caption": "<caption_for_fulltext>" }, "tags": [ { "id": "<tag id>", "title": "<tag title>", "alias": "<tag alias>", "language": "<tag language>" }, ... ], "fields": [ { "id": "<field id>", "title": "<field title>", "name": "<field name>", "type": "<field type>", "default_value": "<default value>", "group_id": "<field group id>", "label": "<field label>", "description": "<field description>", "required": "<field required>", "value": "<field value>", "rawvalue": "<field raw value>" }, ... ], "metakey": "<meta keywords>", "metadesc": "<meta description>", "metadata": { "robots": "<meta robots>", "author": "<meta author>", "rights": "<meta content rights>", "xreference": "<meta external reference>" }, "language": "<language code>", "category_title": "<category title>", "category_alias": "<category alias>", "author": "<article author>", "created_date": "<created date>", "modified_date": "<modified date>", "published_date": "<publish up date>", "unpublished_date": "<publish down date>", "state": "<article state>" }, ... { ... } ] }
State:
Max subs:
Number of subcategories to include (default 0=none)
Featured:
hide,only,show (default)
Order by:
id, title, alias, catid, state, created, created_by, ordering (default), hits
Order dir:
asc (default), desc
Dates are in ISO 8601 format (e.g 2017-05-11T10:16:32+00:00)
Property content is present only if plugin's option Content in article list is set.
Property tags is present only if plugin's option Add tags in article list is set.
Property fields is present only if plugin's option Prepare content in article list is set.
action=get module=content resource=articles id=<N>
<end-point>?action=get&module=content&resource=articles&id=<N>
<end-point>/get/content/articles/<N>
{ "status": "ok", "id": "<article id>", "title": "<article title>", "alias": "<article alias>", "featured": "<featured>", "introtext": "<article intro text>", "content": "<article content>", "content_raw": "<article content raw>", "catid": "<article category id>", "images": { "image_intro": "<image_url_for_intro>", "float_intro": "<float_side_for_intro>", "image_intro_alt": "<alt_text_for_intro>", "image_intro_caption": "<caption_for_intro>", "image_fulltext": "<image_url_for_fulltext>", "float_fulltext": "<float_side_for_fulltext>", "image_fulltext_alt": "<alt_text_for_fulltext>", "image_fulltext_caption": "<caption_for_fulltext>" }, "tags": [ { "id": "<tag id>", "title": "<tag title>", "alias": "<tag alias>", "language": "<tag language>" }, ... ], "associations": [ ], "event": { "afterDisplayTitle": "<after display title>", "beforeDisplayContent": "<before display content>", "afterDisplayContent": "<after display content>" }, "fields": [ { "id": "<field id>", "title": "<field title>", "name": "<field name>", "type": "<field type>", "default_value": "<default value>", "group_id": "<field group id>", "label": "<field label>", "description": "<field description>", "required": "<field required>", "value": "<field value>", "rawvalue": "<field raw value>" }, ... ], "cck_fields": [ ], "metakey": "<meta keywords>", "metadesc": "<meta description>", "metadata": { "robots": "<meta robots>", "author": "<meta author>", "rights": "<meta content rights>", "xreference": "<meta external reference>" }, "language": "<language code>", "category_title": "<category title>", "category_alias": "<category alias>", "author": "<article author>", "parent_id": "<parent id>", "parent_title": "<parent title>", "parent_alias": "<parent alias>", "parent_route": "<parent route>", "created_date": "<created date>", "modified_date": "<modified date>", "published_date": "<publish up date>", "unpublished_date": "<publish down date>", "version": "<article version>", "hits": "<article hits>", "rating": "<article rating>", "rating_count": "<article rating count>", "state": "<article state>" }
State:
Dates are in ISO 8601 format (e.g 2017-05-11T10:16:32+00:00)
Language can be "*" if any.
Property content_raw is present only if plugin's option Include content raw is set.
Property event is present only if plugin's option Show article event is set.
Property cck_fields is present only if plugin's option Include CCK is set.
action=get module=content resource=tagarticles tagid=<T1,T2,...,Tn> limit=<L> (optional) offset=<O> (optional)
<end-point>?action=get&module=content&resource=tagarticles&tagid=<T>&limit=<L>&offset=<O>
<end-point>/get/content/tagarticles?tagid=<T>&limit=<L>&offset=<O>
{ "status": "ok", "total": <total articles>, "limit": <pagination limit>, "offset": <pagination offset>, "pages_current": <current page>, "pages_total": <total pages>, articles: [ { "id": "<article id>", "title": "<article title>", "alias": "<article alias>", "featured": "<featured>", "content": "<article content>", "images": { "image_intro": "<image_url_for_intro>", "float_intro": "<float_side_for_intro>", "image_intro_alt": "<alt_text_for_intro>", "image_intro_caption": "<caption_for_intro>", "image_fulltext": "<image_url_for_fulltext>", "float_fulltext": "<float_side_for_fulltext>", "image_fulltext_alt": "<alt_text_for_fulltext>", "image_fulltext_caption": "<caption_for_fulltext>" }, "tags": [ { "id": "<tag id>", "title": "<tag title>", "alias": "<tag alias>", "language": "<tag language>" }, ... ], "metadesc": "<meta description>", "metakey": "<meta keywords>", "metadata": { "robots": "<meta robots>", "author": "<meta author>", "rights": "<meta content rights>", "xreference": "<meta external reference>" }, "category_title": "<category title>", "author": "<article author>", "published_date": "<article date>" }, ... { ... } ] }
Dates are in ISO 8601 format (e.g 2017-05-11T10:16:32+00:00)
action=get module=content resource=articlebyalias id=<alias>
<end-point>?action=get&module=content&resource=articlebyalias&id=<alias>
<end-point>/get/content/articlebyalias/<alias>
Same response as "Get an article"
Same notes as "Get an article".
The following options are available for user plugin:
Option | Description |
Filter language | Filter content by language. |
Status | Filter content by state. |
Access archived articles | Allow get article on archived items. |
Grant access | Skip access permissions check and allow access to articles. |
Full image URL | Generate absolute URL (i.e. with domain) for images fields. |
Force full image URL in content | Try to replace relative image URL in content with absolute URL. |
Add tags in article list | Include article tags in the list of articles. |
Prepare content in article list | Call onContent events on each article in the list of articles. |
Content in article list | Include full content in the list of articles. |
Show article event | Include results of events in the article response. |
Include content raw | Include raw content (no content plugin) in the article response. |
Include CCK | Include SEBLOD CCK custom fields in the article response. |
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.
action=post module=user resource=login username=<username> password=<password>
<end-point>?action=post&module=user&resource=login&username=<username>&password=<password>
<end-point>/post/user/login?username=<username>&password=<password>
{ "status": "ok", "userid": <userid>, "username": "<username>", "session_id": "<session_id>" }
action=get module=user resource=logout
<end-point>?action=get&module=user&resource=logout
<end-point>/get/user/logout
{ "status": "ok" }
action=post module=user resource=register username=<username> password=<password> email=<email> firstname=<firstname> lastname=<lastname>
<end-point>?action=post&module=user&resource=register&username=<username>&password=<password>&email=<email>&firstname=<firstname>&lastname=<lastname>
<end-point>/post/user/register?username=<username>&password=<password>&email=<email>&firstname=<firstname>&lastname=<lastname>
{ "status": "ok" }
Sends an email to the user's account with a password remind link.
action=get module=user resource=remind email=<email>
<end-point>?action=get&module=user&resource=remind
<end-point>/get/user/remind
{ "status": "ok" }
Sends an email to the user's account with a password reset link.
action=get module=user resource=reset email=<email>
<end-point>?action=get&module=user&resource=reset
<end-point>/get/user/reset
{ "status": "ok" }
action=get module=user resource=profile
<end-point>?action=get&module=user&resource=profile
<end-point>/get/user/profile
{ "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>" } }
Allows to update the user profile (user must be authenticated). The requests must use the POST method with a JSON payload.
action=put module=user resource=profile
POST <end-point>?action=put&module=user&resource=profile
POST <end-point>/put/user/profile
{ "name": "<name>", "username": "<username>", "password": "<password>", "email": "<email>", "profile": { "city": "<city>" ... }, "com_fields": { "field-1": "<value 1>", "field-2": "<value 2>" ... } }
{ "status": "ok" }
Allows to check the current status of the user (guest or logged in), and provides some additional information.
action=get module=user resource=status
<end-point>?action=get&module=user&resource=status
<end-point>/get/user/status
{ "status": "ok", "is_guest": <0 or 1>, "user_id": "<user_id>", "session_id": "<session_id>", "session_expire": <session_expire> }
The following options are available for user plugin:
Option | Description |
Auto activate | Automatically activate users on registration and skip any notification email. |
Extended auth request | Process register, remind and reset as an authentication request (i.e. these requests can bypass the access restrictions on the endpoint). |
Extended fields | Enable support for additional fields in the registration. |
External libraries | List of paths (relative to JPATH_SITE) of external libraries to load in the registration (one path each row). |
Required fields | List 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 Login | Enable JSON payload on login action. |
JSON Register | Enable JSON payload on register action. |
Enable session id | When 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. |
Once an end-point is published the web clients can start to make HTTP requests and consume services provided by jBackend API. It is possible to test if all is working as expected using any REST client that allows to build custom HTTP requests (much better if the client supports JSON decode to better show server responses). Some good clients are available as browser plugin for both Firefox and Chrome. We suggest REST Easy for Firefox and Postman - REST Client for Chrome.
Let's assume the end-point menu item can be accessed with the following URL:
http://www.mysite.com/index.php/jbackend
Calling just the URL without any parameter we will get the following JSON response:
{ "status": "ko", "error_code": "REQ_MNS", "error_description": "Module not specified" }
Note that the HTTP Response Code is always 200 even in case of errors. The error condition is reported by the "status" value (ok, ko). Additional information about the error can be found in the "error_code" and the "error_description" values.
To check jBackend features it is available a sandbox with the last version of jbackend and all modules installed, and free access type on the end-point. To play with the sandbox a Postman collection is available to download here:
http://www.selfget.com/downloads/file/41-jbackapp-postman-collection.html
It needs only to be imported into Postman and is ready to play.
jBackend includes a fully featured platform for sending Push Notifications over Google GCM (Android) and Apple APNs (iOS). Moreover, it supports multiple mobile applications, and you can manage them all from a single Joomla installation.
The component interface includes functions to manage Apps, Devices and Notifications, and there's a Push module to interact with jBackend from the outside (e.g. to send registration token from your app or start the push notification sending process).