Joooid Rpc for Javascript

data 02/06/2012

Joooid Api for Javascript is based on json-xml-rpc project (http://code.google.com/p/json-xml-rpc/) and is a wrapper for the Joooid api exposed by Joooid Component/Plugin, this library represent a handy way to make Ajax calls for fetching categories/articles to display in your modles/components. You can see a live demo here.

The following snippet of code is an example of use of Joooid Rpc for javascript :

{codecitation style="brush: javascript;"} var joooidRpc = new JoooidRpc('index.php?option=com_joooid' , 'demo' , 'demo'); var cats = joooidRpc.getCategories(); var articles = joooidRpc.getArticles(cats[0].id, 50); {/codecitation}

Remeber that the XSS javascript restriction policy doesn't allow your browser to remotely call a different domain except the one it reiceived the script from, basically you can't call Joooid webservices from a different Joomla installation but only from the one that host the script. Soon some documentation.

Here the structure of object Category, as it returns from the server: {codecitation style="brush: javascript;"} { access: this parameter defines the access level of the category, so how can see this category (i.e. public, registered, special) alias: the alias of the category, this should be unique created_user_id: the id of the user that has created this category date: the creation date of the catogry description: the description of the category id: id of the category language: language of the category (if this is'nt a multi language site the default value is *) level: the level of the category in the categories hierarchy parent_id: the id of the parent of this category. The root category has id=1 path: usually the same of alias, this is used in urls if you have SEO plugins active permissions: writing permissions of this category, usually you should ignore this with JJA. This field has the form "10101" and represent the permission (in order) for: create, delete, edit, edit.state, edit.own published: if this category is published (visible to users) it has value = 1, if it's unpublished it has value = 0, if it's trashed it has value = 2 title: the title of the category, also category name } {/codecitation} and this is the structure of object Article

{codecitation style="brush: javascript;"} { access: this parameter defines the access level of the article, so how can see (read) this article (i.e. public, registered, special) alias: the alias of the article, this should be unique categories: the list of categories this article belong to. it is an array of strings (names of the categories), for example: Sample Data-Articles catid: the id of the category this article belongs to date: last modify date of the article date_created: creation date of the article description: the description of the article, i.e the abstract, i.e. what you can read in frontpage before the link: read more frontpage: if this article is promoted to frontpage or not. In the former case it has value = 1, in the latter case it has value = 0 link: full link to the article, for example: "http://www.yourjoomlasite.com/index.php?option=com_content&view=article&id=20&catid=4&Itemid=22" permissions: writing permissions of this article, usually you should ignore this with JJA. This field has the form "10101" and represent the permission (in order) for: create, delete, edit, edit.state, edit.own postid: the id of the article state: if this article is published (visible to users) it has value = 1, if it's unpublished it has value = 0, if it's trashed it has value = 2 text_more: the full body of the article, i.e. its content title: the title of the article userid: the user that has created this article } {/codecitation}

{kunena_discuss:440}