API

Disk Images

Disk Images contains the contents and structure of a disk volume or of an entire data storage device on the Civo cloud platform.


List disk images

A list of disk images accessible from an account is available by sending a GET request to https://api.civo.com/v2/disk_images.

Request

This request requires no parameters.

Response

The response is a JSON array of objects that describes summary details for each disk image.

[
            {
                "id": "b82168fe-66f6-4b38-a3b8-5283542d5475",
                "name": "centos-7",
                "version": "7",
                "state": "available",
                "distribution": "centos",
                "description": null,
                "label": null
            },
            //...
        ]

Example of listing instances

curl -H "Authorization: bearer 12345" https://api.civo.com/v2/disk_images
// At a shell prompt run:
// npm init -y
// npm i --save request

var request = require('request');

request.get(
  'https://api.civo.com/v2/disk_images',
  {},
  function (error, response, body) {
    if (!error && response.statusCode == 200) {
      console.log(body)
    }
  }
).auth(null, null, true, '12345');
require 'net/http'

http = Net::HTTP.new('api.civo.com', 443)
http.use_ssl = true

headers = {
  'Authorization' => 'bearer 12345',
  'Content-Type' => 'application/x-www-form-urlencoded'
}

resp, data = http.get('/v2/disk_images', headers)

Retrieving a disk image

A single disk image's details are available by sending a GET request to https://api.civo.com/v2/disk_images/:id.

Request

This request requires only the ID parameter in the URL.

Response

The response is a JSON object that describes the details for the disk image.

{
            "id": "b82168fe-66f6-4b38-a3b8-5283542d5475",
            "name": "centos-7",
            "version": "7",
            "state": "available",
            "distribution": "centos",
            "description": null,
            "label": null
        }

Example of retrieving a disk image

curl -H "Authorization: bearer 12345" https://api.civo.com/v2/disk_images/12345
    
// At a shell prompt run:
// npm init -y
// npm i --save request

var request = require('request');

request.get(
  'https://api.civo.com/v2/disk_images/12345',
  {},
  function (error, response, body) {
    if (!error && response.statusCode == 200) {
      console.log(body)
    }
  }
).auth(null, null, true, '12345');
require 'net/http'

http = Net::HTTP.new('api.civo.com', 443)
http.use_ssl = true

headers = {
  'Authorization' => 'bearer 12345',
  'Content-Type' => 'application/x-www-form-urlencoded'
}

resp, data = http.get('/v2/disk_images/12345', headers)