Displaying items by tag: content

Saturday, 19 April 2014 00:00

Content Module API

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.

Get the list of categories

Request parameters

action=get
module=content
resource=categories
rootid=<R> (optional)
recursive=<true or 1> (optional)
countitems=<true or 1> (optional)

Example

<end-point>?action=get&module=content&resource=categories&rootid=<R>&recursive=<false>&countitems=<0>

Example (REST format)

<end-point>/get/content/categories?rootid=<R>

Response

{
    "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>
        }
    ]
}

Notes

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.

 

Get a category

Request parameters

action=get
module=content
resource=categories
id=<N>

Example

<end-point>?action=get&module=content&resource=categories&id=<N>

Example (REST format)

<end-point>/get/content/categories/<N>

Response

{
    "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>"
}

Notes

Language can be "*" if any. Category id can be "root" for root node.

 

Get the list of articles

Request parameters

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)

Example

<end-point>?action=get&module=content&resource=articles&catid=<C>&maxsubs=<S>&featured=<F>&orderby=<id>

Example (REST format)

<end-point>/get/content/articles?catid=<C>&limit=<L>&offset=<O>

Response

{
    "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>"
            },
            ...
            {
                ...
            }
    ]
}

Notes

State:

  • Published = 1,
  • Unpublished = 0,
  • Archived = 2,
  • Trashed = -2

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.

 

Get an article

Request parameters

action=get
module=content
resource=articles
id=<N>

Example

<end-point>?action=get&module=content&resource=articles&id=<N>

Example (REST format)

<end-point>/get/content/articles/<N>

Response

{
    "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>"
}

Notes

State:

  • Published = 1,
  • Unpublished = 0,
  • Archived = 2,
  • Trashed = -2

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.

 

Get the list of articles by tag id

Request parameters

action=get
module=content
resource=tagarticles
tagid=<T1,T2,...,Tn>
limit=<L> (optional)
offset=<O> (optional)

Example

<end-point>?action=get&module=content&resource=tagarticles&tagid=<T>&limit=<L>&offset=<O>

Example (REST format)

<end-point>/get/content/tagarticles?tagid=<T>&limit=<L>&offset=<O>

Response

{
    "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>"
        },
        ...
        {
            ...
        }
    ]
}

Notes

Dates are in ISO 8601 format (e.g 2017-05-11T10:16:32+00:00)

 

Get an article by alias

Request parameters

action=get
module=content
resource=articlebyalias
id=<alias>

Example

<end-point>?action=get&module=content&resource=articlebyalias&id=<alias>

Example (REST format)

<end-point>/get/content/articlebyalias/<alias>

Response

Same response as "Get an article"

Notes

Same notes as "Get an article".

 

Plugin Settings

jBackend Content Plugin Settings

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.