REST API for Joomla 3.0

user3793310 picture user3793310 · Oct 13, 2014 · Viewed 16.9k times · Source

I'm currently using the Joomla 3.3.6 and need to find a REST API to access the content information, user information and etc. I already tried to use the following REST API, which is developed by TechJoomla, but unable to find a proper documentation about the sample requests, authentication process and so on.

https://techjoomla.com/rest-api-for-joomla

And also i considered the jbackend REST API which is developed as an extension for joomla which seems to be a paid extension.

After lot of googling i'm still struggling to find a REST API to access the Joomla content. Please help me with this issue.

Thank you in advance.

Answer

Steve Tsiopanos picture Steve Tsiopanos · Sep 22, 2015

I ran into the same issue as well which is why I ended up developing a RESTful API for Joomla 3.4.x, powered by the Slim PHP micro-framework. Please note that this is a commercial Joomla package.

The package includes the following:

  • Services Control Panel component
  • Joomla "services" add-on library which includes a version of Slim v2.6.2 (along with several other libraries) obtain via composer and normally found in the vendor folder. More on this later...
  • Services Joomla Plugin
  • Services REST Plugin
  • Services Slim Configuration Plugin
  • Slim JSON API View plugin
  • Slim JSON API Middleware plugin

You might ask, "What is the point of all these plugins?"

The answer is that it allows for compartmentalization of functionality of the core components and opens the door for an easily extensible services routes architecture. Note that new plugins could easily be added with Joomla ACL restricting access to those new routes, for example.

The Services Control Panel allows for creation of tokens on a per-user basis (or even multiple tokens per Joomla user). It also allows the end user to configure the Slim micro-framework parameters and even include a threshold for the API rate-limiting functionality (currently based on requests-per-minute). Actually, that part is totally awesome as it provides live feedback on the state of the API rate threshold within the response header.

The cAPI Core package ("cAPI", short for "Constant API" because everything needs a product name...) is just that - a core package. There is a host of add-ons currently in development, the first one being a secure LDAP JSON API (which connects to Microsoft Active Directory), with lots more cool add-ons to come.

The whole point of all this is to say that, basically, your request has been answered and now a commercially supported solution has finally arrived. Plus, instead of reinventing the wheel, I based the extension on a popular, existing micro-framework (Slim), making it easier for developers to work with or develop on the core, pluggable, framework.

So, you get the best of Joomla (robust ACL, advanced plugin architecture, wealth of extensions) and Sim (proven, standards-compliant, mature RESTful PHP micro-framework), all in one easy to install package.

Exposing a website via an easily queryable API should not be taken lightly. I would hope anyone choosing to do this would implement 100% HTTPS access and security-harden their server(s).

You can find more information here: http://getcapi.org

Hope this gets you going in the right direction.

One more thing:

I read over your question again and read that part about your need to access users and content. These were actually the first service endpoints I worked on:

/api/v1/user/ - Can be used to log a user in and out and returns the activated Joomla session in the response - This also provides for multimodal authentication (both via token in header or username & password in URL string). Basically, it works with your needs. - You force a user logout like this: /api/v1/user/logout/username/joomlasessionid

Basically, this is tailor-made for driving remote services or, say iOS or Android apps.

(GET,POST,PUT,DELETE) /api/v1/content/...

- Provides ability to create, retrieve, update and delete content

(GET,POST,PUT,DELETE) /api/v1/category/...

- Provides ability to create, retrieve, update and delete categories

Also, /api/v1/user/login/(username)/(password)

/api/v1/user/logout/(username)/(joomlasessionid)

/api/v1/user/profile

/api/slim/routes

and more...

Additional information on available methods can be found here:

http://learn.getcapi.org/api-methods

It should go without saying that all cAPI Core package improves are included in the annual subscription fee. Add-ons are (will be) billed and supported separately. Now listed in the Joomla Extensions Directory (JED) https://extensions.joomla.org/extensions/extension/capi-core-rest-api.

Update 2016-03-28

As of cAPI v1.2.1 new methods have been added to allow CRUD for Joomla user and group management. In addition, I am working on a sandbox cluster at http://getcapi.io to allow potential customers to fully test out the APIs capabilities before subscribing.

Update 2016-09-18

As of cAPI v1.2.5 new methods have been added to allow CRUD actions on API tokens. The API has also been updated with doc-blocks which can auto-generate a Swagger.json. cAPI includes both a back-end and front-end view for accessing the complete API docs generated by Swagger UI.

Finally, https://getcapi.io along with demo1.getcapi.io and demo2.getcapi.io are now live and allow visitors to test the API docs. Soon, they will be configured to auto-reset so that accounts can be distributed to customers so they may fully test the API on their own.