# Services
# List Services
Get a list of all services.
# HTTP request:
GET https://api.serveravatar.com/organizations/{organization}/servers/{server}/services
# Curl Request Example:
curl --request GET \
--url "https://api.serveravatar.com/organizations/{organization}/servers/{server}/services" \
--header 'content-type: application/json' \
--header 'Authorization: <YOUR API TOKEN>'
# Response:
# Server Services List
- 200 (Ok)
{
"services": [
{
"name": "nginx",
"status": true,
"resourceUsage": {
"ram": 1.4,
"cpu": 0
}
},
{
"name": "mariadb",
"status": true,
"resourceUsage": {
"ram": 0.7,
"cpu": 0
}
},
{
"name": "postfix",
"status": true,
"resourceUsage": {
"ram": 2.3,
"cpu": 0
}
},
.....
]
}
# Organization Not Found
- 404 (Not found)
{
"message": "Organization not found."
}
# Server Not Found
- 404 (Not Found)
{
"message": "Server not found!"
}
# Server Error
- 500 (Internal Server Error)
{
"message": "Something went really wrong!"
}
# Service Update
Update services on the server.
# HTTP Request:
POST https://api.serveravatar.com/organizations/{organization}/servers/{server}/services
# Parameter:
| Parameters | Required | Value | Description |
|---|---|---|---|
| service | Yes | String | Select any one service: apache2, nginx , mysql, mariadb, mongod, php7.0-fpm, php7.1-fpm, php7.2-fpm, php7.3-fpm, php7.4-fpm, php8.0-fpm, php8.1-fpm, php8.2-fpm, php8.3-fpm, php8.4-fpm,php8.5-fpm,postfix, ssh, ufw or redis. |
| action | Yes | String | Select any one action: start, stop, restart, or reload. |
# Curl Request Example:
curl --request POST \
--url "https://api.serveravatar.com/organizations/{organization}/servers/{server}/services" \
--header 'content-type: application/json' \
--header 'accept: application/json' \
--header 'Authorization: <YOUR API TOKEN>' \
--data '{
"service": "php7.4-fpm",
"action": "stop"
}'
# Response:
# Server Service Update
- 200 (Ok)
{
"message": "php7.4-fpm has been stop successfully!"
}
# Organization Not Found
- 404 (Not found)
{
"message": "Organization not found."
}
# Server Not Found
- 404 (Not Found)
{
"message": "Server not found!"
}
# Invalid Input
- 500 (Internal Server Error)
{
"message": "The data provided is invalid!"
}
# Server Error
- 500 (Internal Server Error)
{
"message": "Something went really wrong!"
}
# Get PHP-FPM Content
# HTTP Request:
POST https://api.serveravatar.com/organizations/{organization}/servers/{server}/services/php-fpm
# Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| service | Yes | String | Select any one service from php7.0-fpm, php7.1-fpm, php7.2-fpm, php7.3-fpm, php7.4-fpm, php8.0-fpm, php8.1-fpm, php8.2-fpm, php8.3-fpm, php8.4-fpm, php8.5-fpm to retrieve the PHP FPM configuration. |
# Curl Request Example:
curl --request POST \
--url "https://api.serveravatar.com/organizations/5/servers/15/services/php-fpm" \
--header 'content-type: application/json' \
--header 'accept: application/json' \
--header 'Authorization: <YOUR API TOKEN>' \
--data '{
"service": "php8.1-fpm"
}'
# Response:
# Success Response:
- 200 (Ok)
{
"content": {
"data": "; Start a new pool named 'www'.\n; the variable $pool can be used in any directive and will be replaced by the\n; pool name ('www' here)\n[www]\n\n; Per pool prefix\n; It only applies on the following directives:\n; - 'access.log'\n; - 'slowlog'\n; - 'listen' (unixsocket)\n; - 'chroot'\n; - 'chdir'\n; - 'php_values'\n; - 'php_admin_values'\n; When not set, the global prefix (or /usr) applies instead.\n; Note: This directive can also be relative to the global prefix.\n; Default Value: none\n;prefix = /path/to/pools/$pool\n\n; Unix user/group of the child processes. This can be used only if the master\n; process running user is root. It is set after the child process is created.\n; The user and group can be specified either by their name or by their numeric\n; IDs.\n; Note: If the user is root, the executable needs to be started with\n; ....",
"status": "success"
}
}
# Unsupported Web Server:
- 500 (Internal Server Error)
{
"message": "The selected web server is not supported for this operation."
}
# Unsupported Service:
- 500 (Internal Server Error)
{
"message": "The requested service {service} is not available on this server."
}
# Server Error
- 500 (Internal Server Error)
{
"message": "Something went wrong."
}
# Update PHP-FPM Content
Update PHP-FPM Content
# HTTP Request:
PATCH https://api.serveravatar.com/organizations/{organization}/servers/{server}/services/php-fpm
# Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| service | Yes | String | Select any one Service: php7.0-fpm, php7.1-fpm, php7.2-fpm, php7.3-fpm, php7.4-fpm, php8.0-fpm, php8.1-fpm, php8.2-fpm, php8.3-fpm, php8.4-fpm, php8.5-fpm to update the PHP FPM configuration. |
| content | Yes | String | Updated content for the PHP-FPM INI file. |
# Curl Request Example
curl --request PATCH \
--url "https://api.serveravatar.com/organizations/5/servers/15/services/php-fpm" \
--header 'content-type: application/json' \
--header 'accept: application/json' \
--header 'Authorization: <YOUR API TOKEN>' \
--data '{
"service": "php8.1-fpm",
"content": "; Start a new pool named 'www'.\n; the variable $pool can be used in any directive and will be replaced by the\n;...."
}'
# Response:
# Success Response
- 200 (OK)
{
"message": "PHP-FPM INI file content updated successfully."
}
# Unsupported Web Server
- 500 (Internal Server Error)
{
"message": "The selected web server is not supported for this operation."
}
# Unsupported Service:
- 500 (Internal Server Error)
{
"message": "The requested service {service} is not available on this server."
}
# Server Error
- 500 (Internal Server Error)
{
"message": "Something went wrong."
}
# Install PHP Version
Install Specific PHP Version on the server.
# HTTP Request:
PATCH https://api.serveravatar.com/organizations/{organization}/servers/{server}/services/install-php-version
# Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| service | Yes | String | Select any one PHP version from 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5 to install on the server. Ensure that the selected version must be supported by the server. |
# Curl Request Example
curl --request PATCH \
--url "https://api.serveravatar.com/organizations/5/servers/15/services/install-php-version" \
--header 'content-type: application/json' \
--header 'accept: application/json' \
--header 'Authorization: <YOUR API TOKEN>' \
--data '{
"service": "8.1"
}'
# Response:
# Success Response
- 200 (OK)
{
"message": "PHP {PHP version} has been successfully installed on the server (Your Server IP)."
}
# Unsupported Web Server:
- 500 (Internal Server Error)
{
"message": "PHP installation is not supported on MERN stack servers."
}
# Unsupported PHP Version:
- 500 (Internal Server Error)
{
"message": "PHP {PHP Version} is not supported on this server configuration."
}
# Server Error
- 500 (Internal Server Error)
{
"message": "Something went wrong."
}