In this article I want to introduce to you the Joooid xml-rpc api: the xml remote procedure call used by Joooid App to connect to Joomla. The reason why I'm writing such stuff is that I've recently added in the download area some new files : Joooid Api fo Java and Joooid Api for Javascript.
Xml-rpc is an old but widely used protocol for webservices in xml/json, wich evolved in what is now soap, the protocol works over http (like web pages) and basically uses xml to encode it's calls/responses.
In this scheme (stolen by this article form joomla.fr, many thanks to Garstud) you can see an overview of Joomla/Joooid communications :

This scheme is the Joomla 1.5 way to handle xml-rpc webservices, for Joomla 2.5 the mechanism is slightly different because xml-rpc are not in Joomla core anymore.

You can see live the request/response packages watching this live demo with firebug for firefox or chrome inspector. This demo is made with the JoooidRpc client for Javascript and some JQuery UI components (Tabs/Accordion), in the tabs are loaded the categories, when you click on a category the relative articles are loaded (only at the first click, if the content is already loaded the call is skipped).

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 :

var joooidRpc = new JoooidRpc('index.php?option=com_joooid' , 'demo' , 'demo');

var cats = joooidRpc.getCategories();

var articles = joooidRpc.getArticles(cats[0].id, 50);

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:

  {
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
}
  
and this is the structure of object Article

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

{kunena_discuss:440}

Joooid Rpc for Android is an Android Library containing the rpc-client used in Joooid App, including debugging options. Joooid Rpc for Android is based on android-xmlrpc project and is a wrapper for the Joooid api exposed by Joooid Component/Plugin for Joomla 1.5 and 2.5, you can use them in any Android project simply adding the Joooid Library Project to your project (tutorial : how to reference an android library).

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


JoooidRpc rpcClient rpcClient = rpcClient.getInstance(
    "http://www.joooid.com/demo",
    Constants.TASK_WS_URI_J17, 
    "demo", "demo", User.JOOMLA_16);

  try {

    ArrayList<Category> catArray = rpcClient.usersBlogs("demo", "demo");
    Log.e("Joooid Rpc Client", catArray.toString());
  
  } catch (XMLRPCException e) {
    e.printStackTrace();
  }
}

{kunena_discuss:441}