Fork me on GitHub
Cartoque A free & simple CMDB for your datacenter

API Endpoints for Servers

« Back to the list of API endpoints

Get a list of all servers

GET /servers.json

Example with curl:

curl -sLH "X-Api-Token: abcde123456" http://my-cartoque-server/servers.json

Expected response:

{
  "servers": [
    {
      "id": "ab433",
      "name": "server-01",
      "hypervisor_name": "xenhost-01",
      "memory_GB": 2.0,
      "processor_system_count": 4,
      "processor_reference": "Intel Xeon",
      "processor_frequency_GHz": 2.6,
      "extended_attributes": {
        "foo": "bar"
      }
    },
    {
      "id": "ab434",
      "name": "server-02",
      "hypervisor_name": null,
      "memory_GB": 1.0,
      "processor_system_count": 2,
      "processor_reference": "Intel Xeon",
      "processor_frequency_GHz": 2.4,
      "extended_attributes": {
        "foo": "bar"
      }
    }
  ]
}

Parameters:

  • search=[term] : filters on servers which name include [term]
  • by_location=[site:id|room:id] : filters on site (room) or physical rack id = [id]
  • by_maintainer=id : filters on maintainer with id = [id]
  • by_system=id : filters on operating system id = [id] + its descendants (i.e. filtering on Linux will also search sub-operating systems, for instance Debian, etc.)
  • by_virtual=[0|1] : filters on whether the servers are virtual or not ; "1" means virtual, "0" means not virtual
  • by_serial_number=[serial] : filters server by serial number
  • by_arch=[arch] : filters by server architecture if available
  • by_fullmodel=[term] : filters on manufacturer or model containing [term]

Show a specific server

GET /servers/:id.json

Example with curl:

curl -sLH "X-Api-Token: abcde123456" http://my-cartoque-server/servers/433.json

Expected response:

{
  "server": {
    "id": "ab433",
    "name": "server-01",
    "hypervisor_name": "xenhost-01",
    "ip": "192.168.1.1",
    "memory_GB": 2.0,
    "processor_system_count": 4,
    "processor_reference": "Intel Xeon",
    "processor_frequency_GHz": 2.6,
    "extended_attributes": {
      "foo": "bar"
    }
  }
}

Parameters: none.