Info: The described step can only be performed on the on-premise version of Assets Server, not on the cloud version.
Assets Server API plug-ins extend the Assets Server API with custom functionality, thereby enabling developers to create additional REST services for Assets Server.
An external API can be developed in any programming language and needs to be accessible by the Assets Server node(s). Assets Server acts as a proxy server, handling all traffic between the process calling the API and the external API.
Example: Assume we have a Web shop with products and we want to show product information in an Web client application. In this case, you could create an Assets Server web client plug-in that displays the products and it could fetch the information directly from your shop API. This might work, but has the following disadvantages:
We resolve both by running the API requests through Assets Server.
Cross-origin requests are now no longer required as the client only communicates with Assets Server, not the Shop API. As for authentication: the API plug-in contains support for Assets Server Capabilities, allowing you to for example configure the plug-in in such a way that only users who are logged in to Assets Server are given access to the external API.
An API plug-in consists of a single configuration file named api.config.xml.
Its content is as follows:
<?xml version="1.0" encoding="UTF-8"?> <plugin> <info> <version> <pluginVersion>1.0</pluginVersion> <requiresAtLeast>220.127.116.11</requiresAtLeast> </version> <description>Shop API</description> </info> <api> <url>https://shop-api.mycompany.com/</url> <requiredRoles> <role>ROLE_USER</role> </requiredRoles> </api> </plugin>
The following parameters can be defined:
|pluginVersion||The version of the plug-in.|
|requiresAtLeast||The minimum version of Assets Server that is required.|
|description||A short description of the plug-in.|
|url||The URL of the API to connect to.|
(Optional) The Assets Server role(s) required to run the process:
Step 1. Create a folder containing the api.config.xml file and place it in the following location:
Assets Server location > Config > plugins > active
Step 2. Install it by following the steps described in Installing and managing plug-ins in Assets Server.
A sample plug-in is available on GitHub.