Skip to main content

addWebPluginFromFile

WebPluginWrapper addWebPluginFromFile(system)

POST /api/2.0/settings/webplugins

Add a web plugin

Installs a web plugin into the current portal from an uploaded package, and switches the plugin on straight away. The package is sent as multipart/form-data with exactly one file: a .zip archive holding a config.json manifest and a plugin.js entry point, under the configured size cap of 5 MB by default. Editing the portal settings is required, so a portal owner or administrator, and the installation has to have web plugins and plugin uploading enabled in its configuration. Pass system=true to install the plugin for every portal of the installation, which is accepted on standalone installations only. The call is mutating and not idempotent: a package whose manifest name is already installed replaces the stored files and keeps the settings saved for that name, and the domains the manifest declares are added to the portal Content Security Policy. It returns the freshly installed plugin, enabled, with the url its script is served from. A portal holds up to 100 plugins by default, the manifest name has to be lower-case letters, digits, _, . or -, and the package is rejected when another installed plugin registers the same JavaScript object under a different name. List what is installed with GET api/2.0/settings/webplugins.

Parameters​

NameInTypeDescriptionNotes
systemqueryBooleanWhether the plugin is installed for every portal of the installation rather than only this one. It is accepted on a self-hosted installation alone and refused with 403 elsewhere; an installation-wide plugin also hides a portal plugin that carries the same name.[optional] [example: false]

Responses​

Status codeDescriptionTypeResponse headers
200The installed web plugin, enabled, with the url its script is served fromWebPluginWrapperX-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
400The uploaded package is missing, more than one file was sent, the package is of the wrong type, empty or too large, the archive or its manifest is rejected, or the portal already holds the maximum number of plugins--
403The caller has no portal-settings right, the request is not a form, web plugins or plugin uploads are switched off for the installation, system was requested outside a standalone installation, or the domains the plugin declares would push the Content Security Policy header over its size limit--
401UnauthorizedErrorApiResponse-
429Too Many Requests.ErrorApiResponseRetry-After
500Internal Server Error.ErrorApiResponse-
502Bad Gateway. Returned by the reverse proxy, response body may be HTML and not JSON.--
503Service Unavailable. Returned by the reverse proxy, response body may be HTML and not JSON.--

Return type​

WebPluginWrapper

Authorization​

Basic, OAuth2 (scopes: read, write), ApiKeyBearer, asc_auth_key, Bearer, OpenId

HTTP request headers​

  • Content-Type: Not defined
  • Accept: application/json