There are a few options, but I use the jBackend extension.
Some positives of jBackend.
Nice clean JSON
Comes with good boilerplate code to get started
Manages API keys API endpoint code transmits and receives data
Basically exposes many common CMS functions as API endpoints
Has a normal looking Joomla admin UI for managing API keys
Documentation is good
In the context of a REST Api, each call is stateless. So, there is no "user login".
In a Joomla site, when a user is authenticated, the browser receives a cookie to authorize the navigation and access to restricted areas.
Thus, in a REST Api, you have to implement an authorization protocol, like OAuth, to generate access tokens.
In TechJoomla's com_api, ...
You can actually do it either way depending on which method you prefer. The way you are currently calling the functions in the view.html.php file is fairly common but you can also call those functions from within your layout (sub-view?) by including the model on that page.
$model = JModelLegacy::getInstance('ViewName','ComponentNameModel');
There is no out of the box Joomla API but the team are working on a Web Services part for maybe Joomla 3.6 or soon after. This will then have full oAuth api services. I believe it will be based on the work of redWEB.
At the moment you would need to add an add on. Either one of the options other people have mentioned or a coded api talking direct with the DB....
In my opinion, the best approach is to use a custom plugin, that will be called using com_ajax interface.
It doesn't have to be a 'system' plugin, it can be any group, as it will be specified in url.
for example, you can use the url: index.php?option=com_ajax&group=mycompany&plugin=getmyresponse&format=json
So, it the corresponding plugin ...
Create a new php file (webapi.php) and save it to the root of your site.
Add in the required files to access the Joomla Framework like so:
//ALLOW DIRECT ACCESS
$app = JFactory::getApplication('site');
If you need clean REST urls like :
You can have a look to my project : https://github.com/pvullioud/japi
or if you don't wont to use plugins, you have a more simple exemple here
If you are looking for additional solutions, you may also want to look at the just released cAPI REST API for Joomla (http://getcapi.org). It is powered by the Slim PHP micro-framework, provides a token and parameter management component with accompanying plugins defining major service route groups (and upcoming add-ons).
cAPI provides both simple username/...
If you need only a single URL to return a json string containing just a prepared subset of a single module’s params and a copy of all the paths and titles of a single menu then I would suggest a very hard coded approach would be the quickest - a couple of database queries and some data rustling should do it. A system plugin would be suitable place to put the ...
If your js is attached to a joomla page then you can get your users to login to joomla in the usual way. Then when your js executes an ajax call to the server, because the browser sends the session cookie in the http request, joomla knows if the http request is associated with a logged-in user. So inside your server code handling the ajax request you can do
See the docs for controller task - Model View Controller. Since you want to make it accessible to registered users and not to the public, you can simply check the user and return if your checks do not pass. You can see the getUser method documentation here - Accessing Current User Object
Joomla! 4.0 will have Web Services.
In 3.x, without using extensions or custom code, there's no way to do this for single articles. For article listings (category views) you could use RSS/Atom feed by accessing category view with format=feed parameter appended.
So... I made this far too difficult for myself.
The answer is that I had a space in my code, right after the opening img src=" this was causing the Joomla SEF plugin to prefix my domain URL in the space.
console.log('<img src=" '+url+' ">');
Hope this saves someone else a few ...
Expanding each zip install file and examining the .xml file will tell you the minimum version of Joomla the install file is designed for.
Look for a line similar to the following example which shows, in this case, that the install file is suitable for Joomla 1.5:
<install version="1.5" type="plugin" group="system" method="upgrade">
As you probably ...
We have minimum information about how you have implemented all the above, however, I guess that you have created a php script somewhere that won't be executed/accessed from within Joomla's execution flow, but you are calling it directly. Right? In this case, you skip Joomla, the 403 error you get isn't coming from Joomla. Most likely this is a security ...
I think it would be counter-productive to attempt to rewrite a Joomla component to push and pull data in and out through your api endpoints. I think rather you have several options depending on your needs and abilities.
Install an appropriate 3rd party Joomla component and rewrite your API to push data into the default db tables of the component and delete ...
I had been waiting years for proper REST API support in Joomla, but eventually I ended up rolling my own solution and turned it into a commercial product. The following response is quoted & updated from an earlier response to a similar question:
I ran into the same issue as well which is why I ended up ...
You have to create an authentification plugin see the documnentation :https://docs.joomla.org/J3.x:Creating_an_Authentication_Plugin_for_Joomla/en and my pseudo code below
* @version $Id: myauth.php 7180 2007-04-23 16:51:53Z jinx $
* @package Joomla.Tutorials
* @subpackage Plugins
* @license GNU/GPL
You must use onUserAfterLogin as this triggered after successful login.
Authenticate is called to verify login credentials (for example you can use it to block login for users with specific IP, or to create login with email
Currently there is none. You can check for available extensions (I doubt there will be any worth using) or create simple CLI application for that. It will be resource efficient, fast and more secure then all of public extensions.
If a ready-made made extension is acceptable, then my suggestion is Headless Joomla and the Virtuemart plugin from codingmall. It gives you detailed info for any Joomla view using simple REST calls like this:
"title": "Getting Started",