DCImanager Administrator

Examples of API use

ISPSystem

API functions of DCImanager can be used for integration with the billing system. Before use, log in to DCImanager and get the code of the current user session. Read more in Guide to API DCImanager.

To access API, use the URL in the form: https://domain.com/api/dci/v3/function/ 

domain.com — DCImanager server public IP address or domain name;

function — function to be executed in DCImanager.

Information about servers


Number of free servers and their configuration

curl -X GET 'https://domain.com/api/dci/v3/server/configuration'-H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true'| jq

JSON object in the following form will be delivered in return:

{
  "list": [
    {
      "configuration": "i9-9900K-64Gb-2x1024NVMe",
      "free_server_count": 42
    }
  ]
}

configuration — server configuration;

free_server_count — number of free servers with this configuration.

List of servers

curl -X GET 'https://domain.com/api/dci/v3/server' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true'| jq

JSON object in the following form will be delivered in return:

{
  "list": [
    {
      "operation": {
        "id": 0,
        "status": "string",
        "status_info": {},
        "progress_info": [
          {}
        ]
      },
      "domain": "string",
      "id": 0,
      "os_template": {
        "id": 0,
        "name": "string",
        "tags": [
          "string"
        ]
      },
      "hardware_info": {},
      "perform_info": {},
      "configuration": "string",
      "settings": {
        "efi": true
      },
      "state": "suspending",
      "state_info": "string",
      "ip": [
        {
          "domain": "string",
          "family": "ipv4",
          "gateway": "string",
          "id": 0,
          "name": "string",
          "network": "string",
          "status": "allocating",
          "status_info": {}
        }
      ],
      "switch_connection": [
        {
          "id": 0,
          "switch": 0,
          "connection_id": 0,
          "description": "string",
          "admin_status": "up",
          "oper_status": "up",
          "do_not_collect_traffic": true,
          "is_ipmi_connection": true
        }
      ],
      "pdu_connection": {
        "port_id": 0,
        "port_identity": "string",
        "pdu_id": 0,
        "pdu_name": "string",
        "connection_id": 0,
        "power_status": "up"
      },
      "ipmi": {
        "address": "string",
        "id": 0,
        "status": "on",
        "status_info": {},
        "type": "IPMI v1.5/v2",
        "web_url": "string"
      },
      "intel_amt": {
        "address": "string",
        "id": 0,
        "status": "on",
        "status_info": {},
        "protocol": "http"
      },
      "location": {
        "geolocation": "1st Street, 25",
        "id": 0,
        "name": "string",
        "userspace": 0
      },
      "location_id": 0,
      "mac": "string",
      "main_ipv4": 0,
      "main_ipv6": 0,
      "name": "string",
      "platform": {
        "id": 0,
        "name": "string",
        "size": 0,
        "type": "string"
      },
      "rack": {
        "id": 0,
        "name": "string",
        "size": 0
      },
      "unit": 0,
      "chassis": {
        "id": 0,
        "name": "string",
        "size": 0,
        "server_slot_count": 0
      },
      "slot": 0,
      "owner": {
        "id": 0,
        "email": "string"
      },
      "owner_email": "string",
      "diag_error": [
        {
          "type": "string",
          "info": "string"
        }
      ],
      "is_new": true
    }
  ]
}

operation — operation running on server:

  • id — operation ID;
  • status — operation status;
  • progress_info — progress info;

domain — server domain name;

id — server ID;

os_template — server operating system (OS) template info:

  • id — template ID;
  • name — template name;
  • tags —

hardware_info — server hardware info;

configuration — server configuration;

state — server state. Possible values:

  • suspending — server is entering suspended mode;
  • suspended — server is suspended;
  • suspend_error — server suspend error;
  • resuming — server activity is resuming;
  • ok — server available for operation;
  • resume_error — server resume error;

state_info — server status info;

ip — server IP addresses info:

  • domain — domain name;
  • family — IP version. Possible values: ipv4, ipv6;
  • gateway — gateway IP address;
  • id — IP address ID;
  • name — server IP address;
  • network — network address;
  • status — IP address status. Possible values:
    • allocating — IP address allocation task has been created;
    • in_progress — IP address change task has been created;
    • deleting — IP address deletion task has been created;
    • ok — IP address was allocated successfully;
    • fail — task completion failed;
    • allocation_fail — IP address allocation failed;
  • status_info — IP address status info;

switch_connection — info on server connection switch ports:

  • id — port ID;
  • switch — switch ID;
  • connection_id — connection ID;
  • description — port description;
  • admin_status — status of switch port managed by admin. Possible values:
    • up — port is active;
    • down — port is inactive;
    • testing — port is in test status;
    • unknown — port status unknown.
  • oper_status — switch port connection status. Possible values:
    • up — connection is active;
    • down — connection is inactive;
    • testing — port is in test status;
    • unknown — connection status unknown;

pdu_connection — PDU server connection port info:

  • port_id — port ID;
  • port_identity — PDU port ID;
  • pdu_id — PDU ID;
  • pdu_name — PDU name;
  • connection_id — connection ID;
  • power_status — port status. Possible values:
    • up — port is active;
    • down — port is inactive;
    • unknown — port status unknown;

ipmi — IPMI info:

  • address — IPMI IP address;
  • id — IPMI ID;
  • status — IPMI status. Possible values:
    • on — active;
    • off — inactive;
    • unknown — unknown;
    • in_progress — in progress;
  • status_type — IPMI status type;
  • type — IPMI type. Possible values:
    • IPMI v1.5/v2;
    • IPMI v2(lanplus);
  • web_url — IPMI web interface URL;

location — location info:

  • geolocation — location position;
  • id — location ID;
  • name — location name;
  • userspace — location userspace ID in IPmanager;

location_id — location ID;

mac — server's MAC address;

main_ipv4 — server's main IPv4 address. Used to install OS;

platform — server platform info:

  • id — platform ID;
  • name — platform name;
  • size — platform size;
  • type — platform type;

rack — server rack info:

  • id — rack ID;
  • name — rack name;
  • size — rack size;

unit — unit number in rack.

Server info by ID

curl -X GET 'https://domain.com/api/dci/v3/server/server_id' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true'| jq

server_id — server ID.

JSON object in the following form will be delivered in return:

{
  "operation": {
    "id": 0,
    "status": "string",
    "progress_info": [
      {}
    ]
  },
  "domain": "string",
  "id": 0,
  "os_template": {
    "id": 0,
    "name": "string",
    "tags": [
      "string"
    ]
  },
  "hardware_info": {},
  "configuration": "string",
  "state": "suspending",
  "state_info": "string",
  "ip": [
    {
      "domain": "string",
      "family": "ipv4",
      "gateway": "string",
      "id": 0,
      "name": "string",
      "network": "string",
      "status": "allocating",
      "status_info": {}
    }
  ],
  "switch_connection": [
    {
      "id": 0,
      "switch": 0,
      "connection_id": 0,
      "description": "string",
      "admin_status": "up",
      "oper_status": "up"
    }
  ],
  "pdu_connection": {
    "port_id": 0,
    "port_identity": "string",
    "pdu_id": 0,
    "pdu_name": "string",
    "connection_id": 0,
    "power_status": "up"
  },
  "ipmi": {
    "address": "string",
    "id": 0,
    "status": "on",
    "status_info": {},
    "type": "IPMI v1.5/v2",
    "web_url": "string"
  },
  "location": {
    "geolocation": "string",
    "id": 0,
    "name": "string",
    "userspace": 0
  },
  "location_id": 0,
  "mac": "string",
  "main_ipv4": 0,
  "name": "string",
  "platform": {
    "id": 0,
    "name": "string",
    "size": 0,
    "type": "string"
  },
  "rack": {
    "id": 0,
    "name": "string",
    "size": 0
  },
  "unit": 0
}

operation — operation running on server:

  • id — operation ID;
  • status — operation status;
  • progress_info — progress info;

domain — server domain name;

id — server ID;

os_template — server operating system (OS) template info:

  • id — template ID;
  • name — template name;

hardware_info — server hardware info;

configuration — server configuration;

state — server state. Possible values:

  • suspending — server is entering suspended mode;
  • suspended — server is suspended;
  • suspend_error — server suspend error;
  • resuming — server activity is resuming;
  • ok — server available for operation;
  • resume_error — server resume error;

state_info — server status info;

ip — server IP addresses info:

  • domain — domain name;
  • family — IP version. Possible values: ipv4, ipv6;
  • gateway — gateway IP address;
  • id — IP address ID;
  • name — server IP address;
  • network — network address;
  • status — IP address status. Possible values:
    • allocating — IP address allocation task has been created;
    • in_progress — IP address change task has been created;
    • deleting — IP address deletion task has been created;
    • ok — IP address was allocated successfully;
    • fail — task completion failed;
    • allocation_fail — IP address allocation failed;
  • status_info — IP address status info;

switch_connection — server connection switch ports info:

  • id — port ID;
  • switch — switch ID;
  • connection_id — connection ID;
  • description — port description;
  • admin_status — status of switch port managed by admin. Possible values:
    • up — port is active;
    • down — port is inactive;
    • testing — port is in test status;
    • unknown — port status unknown.
  • oper_status — switch port connection status. Possible values:
    • up — connection is active;
    • down — connection is inactive;
    • testing — port is in test status;
    • unknown — connection status unknown;

pdu_connection — PDU server connection port info:

  • port_id — port ID;
  • port_identity — PDU port ID;
  • pdu_id — PDU ID;
  • pdu_name — PDU name;
  • connection_id — connection ID;
  • power_status — port status. Possible values:
    • up — port is active;
    • down — port is inactive;
    • unknown — port status unknown;

ipmi — IPMI info:

  • address — IPMI IP address;
  • id — IPMI ID;
  • status — IPMI status. Possible values:
    • on — active;
    • off — inactive;
    • unknown — unknown;
    • in_progress — in progress;
  • type — IPMI type. Possible values:
    • IPMI v1.5/v2;
    • IPMI v2(lanplus);
  • web_url — IPMI web interface URL;

location — location info:

  • geolocation — location position;
  • id — location ID;
  • name — location name;
  • userspace — location userspace ID in IPmanager;

location_id — location ID;

mac — server's MAC address;

main_ipv4 — server's main IPv4 address. Used to install OS;

platform — server platform info:

  • id — platform ID;
  • name — platform name;
  • size — platform size;
  • type — platform type;

rack — server rack info:

  • id — rack ID;
  • name — rack name;
  • size — rack size;

unit — unit number in rack.

Operations with users


List of all users

curl -X GET 'https://domain.com/api/dci/v3/user' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true'| jq

JSON object in the following form will be delivered in return:

{
  "list": [
    {
      "id": 0,
      "email": "string",
      "server_count": 0,
      "roles": "[@user]",
      "vlans_per_user": 5
    }
  ]
}

id — user ID;

email — user email for authorization;

server_count — number of user owned servers;

roles — list of user roles. Possible value of list elements: @admin — administrator, @user — user;

vlans_per_user — the number of VLANs available to the user

Adding a user

curl -X POST 'https://domain.com/api/dci/v3/user' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'x-xsrf-token: E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true' -d '{"email":"admin@example.com","full_name":"name","password":"pass","phone_number":"phone","role":"level"}' | jq

admin@example.com — authorization email;

name — user full name;

pass — user password;

phone — user phone;

level — user role. Possible values: @admin — administrator, @user — user.

JSON object in the following form will be delivered in return:

{
  "id": 0
}

User assignment as server owner

curl -X POST 'https://domain.com/api/dci/v3/server/server_id/owner' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'x-xsrf-token: E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true' -d '{"owner":user_id}' | jq

server_id — server ID;

user_id — user ID.

JSON object in the following form will be delivered in return:

{
  "id": 0
}

Server release

curl -X DELETE 'https://domain.com/api/dci/v3/server/server_id/owner' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'x-xsrf-token: E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true'| jq

server_id — server ID.

JSON object in the following form will be delivered in return:

{
  "id": 0
}

Operations with switch ports


Activate server connection ports

curl -X POST 'https://domain.com/api/dci/v3/server/server_id/resume' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'x-xsrf-token: E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true' -d '{}'| jq

server_id — server ID.

JSON object in the following form will be delivered in return:

{
  "id": 0,
  "task": 0
}

Deactivate server connection ports

curl -X POST 'https://domain.com/api/dci/v3/server/server_id/suspend' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'x-xsrf-token: E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true' -d '{}'| jq

server_id — server ID.

JSON object in the following form will be delivered in return:

{
  "id": 0,
  "task": 0
}

Operations with server power


Power on

curl -X POST 'https://domain.com/api/dci/v3/server/server_id/power_on' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'x-xsrf-token: E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true' -d '{}'| jq

server_id — server ID.

JSON object in the following form will be delivered in return:

{
  "id": 0,
  "task": 0
}

Power off

curl -X POST 'https://domain.com/api/dci/v3/server/server_id/power_off' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'x-xsrf-token: E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true' -d '{}'| jq

server_id — server ID.

JSON object in the following form will be delivered in return:

{
  "id": 0,
  "task": 0
}

Reboot

curl -X POST 'https://domain.com/api/dci/v3/server/server_id/power_reset' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'x-xsrf-token: E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true' -d '{}'| jq

server_id — server ID.

JSON object in the following form will be delivered in return:

{
  "id": 0,
  "task": 0
}

Operations with IP addresses


Getting IP addresses list

curl -X GET 'https://domain.com/api/dci/v3/ip' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true'| jq


JSON object in the following form will be delivered in return:

{
  "list": [
    {
      "domain": "string",
      "family": "ipv4",
      "gateway": "string",
      "id": 0,
      "name": "string",
      "network": "string",
      "server": "string",
      "status": "allocating",
      "status_info": {}
    }
  ]
}

domain — domain name of the server allocated with the IP address;

family — IP version. Possible values: ipv4, ipv6;

gateway — gateway IP address;

id — IP address ID;

name — IP address;

network — IP address network;

server — server allocated with the IP address;

status — IP address status. Possible values:

  • allocating — IP address allocation task has been created;
  • in_progress — IP address change task has been created;
  • deleting — IP address deletion task has been created;
  • ok — IP address was allocated successfully;
  • fail — task completion failed;
  • allocation_fail — IP address allocation failed;

status_info — IP address status info.

Getting server IP addresses

curl -X GET 'https://domain.com/api/dci/v3/server/server_id/ip' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true'| jq

server_id — server ID.

JSON object in the following form will be delivered in return:

{
  "list": [
    {
      "domain": "string",
      "family": "ipv4",
      "gateway": "string",
      "id": 0,
      "name": "string",
      "network": "string",
      "server": "string",
      "status": "allocating",
      "status_info": {}
    }
  ]
}

domain — server domain name;

family — IP version. Possible values: ipv4, ipv6;

gateway — gateway IP address;

id — IP address ID;

name — IP address;

network — IP address network;

server — server allocated with the IP address;

status — IP address status. Possible values:

  • allocating — IP address allocation task has been created;
  • in_progress — IP address change task has been created;
  • deleting — IP address deletion task has been created;
  • ok — IP address was allocated successfully;
  • fail — task completion failed;
  • allocation_fail — IP address allocation failed;

status_info — IP address status info.

Getting networks list

curl -X GET 'https://domain.com/api/ip/v3/ipnet' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true'| jq

JSON object in the following form will be delivered in return:

{
  "list": [
    {
      "id": 0,
      "name": "string",
      "family": 2,
      "mask": 0,
      "gateway": "string",
      "userspace": 0,
      "vlan": "string",
      "note": "string",
      "size": "string",
      "using_ip": "string",
      "total_ip": "string"
    }
  ]
}

id — network ID;

userspace — userspace ID in IPmanager.

Getting pools list

curl -X GET 'https://domain.com/api/ip/v3/ippool' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true'| jq

JSON object in the following form will be delivered in return:

{
  "list": [
    {
      "id": 0,
      "name": "string",
      "userspace": 0,
      "note": "string",
      "is_public": "string",
      "using_ip": "string",
      "using_ipv4": "string",
      "using_ipv6": "string",
      "total_ip": "string",
      "total_ipv4": "string",
      "total_ipv6": "string"
    }
  ]
}

id — pool ID;

userspace — userspace ID in IPmanager.

IP address allocation to server

curl -X POST 'https://domain.com/api/dci/v3/server/server_id/ip' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'x-xsrf-token: E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true' -d '{"domain":"domain_name","family":"version","ip_name":"address","ip_net":net,"ip_pool":pool,"set_as_main_ipv4":main_ipv4,"userspace":userspace_id}" | jq

server_id — server ID;

domain_name — server domain name;

version — IP version. Possible values: ipv4, ipv6;

address — IP address;

net — IP address network ID;

pool — IP address pool ID;

main_ipv4 — set at the main IPv4 address. Possible values: true, false;

userspace_id — userspace ID in IPmanager.

JSON object in the following form will be delivered in return:

{
  "id": 0,
  "task": 0
}

Deleting IP address from server

curl -X POST 'https://domain.com/api/dci/v3/server/server_id/ip/ip_id' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'x-xsrf-token: E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true' -d '{}'| jq

server_id — server ID;

ip_id — IP address ID.

JSON object in the following form will be delivered in return:

{
  "id": 0,
  "task": 0
}

Operations with server


Server diagnostics

curl -X POST 'https://domain.com/api/dci/v3/server/server_id/operation_diag' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'x-xsrf-token: E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true' -d '{"setup_ipmi":false,"ipmi_pool":0,"os_template_id":0,"clear_hdd":"none"}' | jq

server_id — server ID;

setup_ipmi — whether you need to configure IPMI. Optional parameter. Possible values:

  • true - yes;
  • false - no;

ipmi_pool — id of the pool from which you want to allocate an IP address for IPMI. Optional parameter;

os_template_id — diagnostics template ID;

clear_hdd — HDD clear type. Possible values:

  • none — no HDD clearing;
  • simple — quick HDD clearing;
  • full — full HDD clearing.

JSON object in the following form will be delivered in return:

{
  "id": 0,
  "task": 0
}

Server disks clearing

curl -X POST 'https://domain.com/api/dci/v3/server/server_id/operation_clear_hdd' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'x-xsrf-token: E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true' -d '{"clear_hdd":"none"}' | jq

server_id — server ID;

clear_hdd — HDD clear type. Possible values:

  • none — no HDD clearing;
  • simple — quick HDD clearing;
  • full — full HDD clearing.

JSON object in the following form will be delivered in return:

{
  "id": 0,
  "task": 0
}

OS installation

curl -X POST 'https://domain.com/api/dci/v3/server/server_id/operation_os' -H 'Cookie: ses6=E6900A56BE7DF0FB28ED7BE7' -H 'x-xsrf-token: E6900A56BE7DF0FB28ED7BE7' -H 'isp-box-instance: true' -d '{"hdd_raid":"raid","os_template_id":template_id,"password":"pass","ssh_pub_keys":["ssh_keys"]}' | jq

server_id — server ID;

raid — RAID. Possible values: no_raid, raid_0, raid_1, raid_5, raid_10;

template_id — OS template ID;

pass — server admin password;

ssh_keys — list of public SSH keys.

JSON object in the following form will be delivered in return:

{
  "id": 0,
  "task": 0
}



Related topics

Thank you for your feedback!
Was the article useful?
Tell us why not:

it does not match the title

it was hard to understand

I didn't find the answer

recommendations from the article did not help

other

Tell us what you didn't like in the article: