|Table of Contents|
Installing Component API
The Component API plugin can be installed under [Settings] > [Company] > [Plugins] > [Available].
Configuring Component API
Nothing to configure.
Using Component API
The Component API extends the API by offering a new model method capable of being invoked. This is a wrapper for every core and plugin component installed in the system. Consult the documentation for the component you are attempting to invoke through the API for details on the required parameters
Components are internal objects to Blesta and its respective plugins. Blesta makes no effort to ensure backwards compatibility for components, so the functionality (parameters and return results) of any and all methods executed through this plugin may change at any time.
This plugin has a single model called ComponentApiCaller, which itself has a single callable method called call. Below are the parameters available to this method:
|component||A string, the name of the component you wish to invoke (e.g. InvoiceDelivery)|
|method||A string, the name of the method to invoke for the given component (e.g. DownloadInvoices)|
|params||An array of parameters (each key is the name of the parameter) to pass to the component method|
An array of parameters to pass to the constructor, numerically indexed in the order required by the component constructor. Only required if the component requires parameters to its constructor.
Note all components may be invoked via the API due to requirements for constructor and method parameters. Consult the documentation for the component you wish to invoke.
This example demonstrates how to download an invoice through the API. In this example the invoice ID is 1. Note that invoice_ids is an index of the params array. This is because the InvoiceDelivery component requires an invoice_ids parameters to the downloadInvoices method.
This example pulls invoice ID 1 and 2 in a single download.