# 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, 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!"
}
Last Updated: 1/31/2024, 12:50:34 PM