Adding a Web Service API to your component
Developing a Web Service for our component is quite easy using the Joomla! FrameworkTM. As we have used Joomla! classes and we have respected Joomla! MVC, Joomla! will take care of most of the stuff. To define our Web Service, we first need to define the entry points for the entities we want to expose and then connect our already created models with these entry points.
To define the entry points, we must create a Web Service plugin (we will see how to create plugins in more detail in Chapter 8, but this is a very basic one, so we can handle it right now).
Developing the Web Service plugin
The Web Service plugin defines all the endpoints of our Web Service API. It handles the routing of the endpoint inside the application, and it controls which endpoints need authorization.
Let’s start by adding the manifest file, as we did for our component in Chapter 2. Create the src/plugins/webservice/spm/spm.xml
file with the following...