Install Plugin
POST
/installs/{id}/plugins/{slug}
Add a plugin to the specified instance of WordPress from the WordPress.org plugin directory.
Parameters
API
/installs/{id}/plugins/{slug}
API endpoint. {id} is the internal ID of the install to install the plugin for. {slug} is the internal ID of the plugin to install.
POST
Optional parameters
State of the plugin.
true
= Plugin is activated.
false
= Plugin is deactivated.
default is true
Automatic update configuration for the plugin.
none
= Never update.
all
= All updates will be performed.
default is all
The Installatron Server user the task is to be performed on or for.default is the owner of the installation identified by {id} in the API request
Special parameters
Perform a
test run of this API call: run the tests, check connections to the database server and remote locations, but
don't actually perform this task itself . This is just a test-run to make sure that when it is run
for real that there is nothing to stop it from working.
none
= No dry run.all
= Check all input values and test all connections.input
= Check only the input values.default is none
Response
Response
HTTP status code describing the result of the request.
200
for
Success .
All other numbers represent errors which are described in the
errcode output below.
true
= Success.
false
= Failure.
status code 403
invalid_api_key
The server's Installatron Server Key is invalid.
invalid_argument_user
User specified is not authorized to access this data.
status code 404
install_not_found
The app ID was not found or it was found by is owned by a user who does not have access to it.
plugin_not_found
The specified plugin was not found on the specified install.
user_not_found
The specified user could not be found in the Installatron Server database.
If the cause of an error was an incorrect
field value then this will show the ID of the field.
(eg.
login
,
passwd
,
email
)
Message describing the result of the request. Do not rely on this to determine the success or failure of the request.
↳
The "slug" (aka. internal ID) of the plugin.
(eg.
akismet
,
limit-login-attempts-reloaded
)
↳
State of the plugin.
true
= Plugin is activated.
false
= Plugin is deactivated.
↳
Automatic update configuration for the plugin.
none
= Never update.
all
= All updates will be performed.
↳
Current version of the plugin.
(eg.
5.4.3
)
↳
Full name of the plugin.
(eg.
Akismet Anti-spam: Spam Protection
)
↳
Author's long description of the plugin.
↳
Author's name.
(eg.
Automattic - Anti-spam Team
)
↳
Newest version available of the plugin.
(eg.
5.4.4
)
PHP
CURL
CLI
Full Examples
Example: Add a plugin to the WordPress install with ID 1234567890abcdefghij12345 Method: curl
curl -X POST https://{SERVER_IP}/installs/1234567890abcdefghij12345/plugins/akismet \
-H 'X-API-KEY: {the key= or key2= value from /usr/local/installatron/etc/settings.ini}' \
-H 'Accept: application/json'
Response: json
{
"status": 200,
"result": true,
"message": "The task is complete.\n",
"data": {
"id": "limit-login-attempts-reloaded",
"activated": false,
"autoup": "none",
"version": "2.3.4",
"name": "Limit Login Attempts Reloaded",
"description": "Block excessive login attempts and protect your site against brute force attacks. Simple, yet powerful tools to improve site performance.",
"author": "Limit Login Attempts Reloaded",
"version_available": "2.3.4"
}
}
Full Examples
Example: Add a plugin to the WordPress install with ID 1234567890abcdefghij12345 Method: json payload to curl
Response: json
{
"status": 200,
"result": true,
"message": "The task is complete.\n",
"data": {
"id": "limit-login-attempts-reloaded",
"activated": false,
"autoup": "none",
"version": "2.3.4",
"name": "Limit Login Attempts Reloaded",
"description": "Block excessive login attempts and protect your site against brute force attacks. Simple, yet powerful tools to improve site performance.",
"author": "Limit Login Attempts Reloaded",
"version_available": "2.3.4"
}
}
Full Examples
Example: Add a plugin to the WordPress install with ID 1234567890abcdefghij12345 Method: curl, php, and a user's login
<?php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_URL => "https://{SERVER_IP}/installs/1234567890abcdefghij12345/plugins/akismet",
CURLOPT_HTTPHEADER => [
"X-API-KEY: {the key= or the key2= value from /usr/local/installatron/etc/settings.ini}",
"Accept: application/json"
],
CURLOPT_RETURNTRANSFER => true
]);
if (( $response = curl_exec($ch) )=== false )
{
trigger_error(curl_error($ch));
}
curl_close($ch);
var_export(json_decode($response, true));
?>
Response: json
{
"status": 200,
"result": true,
"message": "The task is complete.\n",
"data": {
"id": "limit-login-attempts-reloaded",
"activated": false,
"autoup": "none",
"version": "2.3.4",
"name": "Limit Login Attempts Reloaded",
"description": "Block excessive login attempts and protect your site against brute force attacks. Simple, yet powerful tools to improve site performance.",
"author": "Limit Login Attempts Reloaded",
"version_available": "2.3.4"
}
}
Full Examples
Example: Add a plugin to the WordPress install with ID 1234567890abcdefghij12345 Method: cli
/usr/local/installatron/installatron \
--POST /installs/1234567890abcdefghij12345/plugins/akismet
Response: json
{
"status": 200,
"result": true,
"message": "The task is complete.\n",
"data": {
"id": "limit-login-attempts-reloaded",
"activated": false,
"autoup": "none",
"version": "2.3.4",
"name": "Limit Login Attempts Reloaded",
"description": "Block excessive login attempts and protect your site against brute force attacks. Simple, yet powerful tools to improve site performance.",
"author": "Limit Login Attempts Reloaded",
"version_available": "2.3.4"
}
}
Full Examples
Example: Add a plugin to the WordPress install with ID 1234567890abcdefghij12345 Method: json payload from cli
Response: json
{
"status": 200,
"result": true,
"message": "The task is complete.\n",
"data": {
"id": "limit-login-attempts-reloaded",
"activated": false,
"autoup": "none",
"version": "2.3.4",
"name": "Limit Login Attempts Reloaded",
"description": "Block excessive login attempts and protect your site against brute force attacks. Simple, yet powerful tools to improve site performance.",
"author": "Limit Login Attempts Reloaded",
"version_available": "2.3.4"
}
}