The Server Density API allows you to manage your entire account programmatically. It's a simple HTTP JSON API and you can quickly get started to pull a list of your servers:

Authentication

All access to the API requires a token rather than a username or password. You can generate tokens via the API but the quickest way is to create one through the web UI:

  1. Log in to your Server Density account.
  2. Click your name in the top left, then click Preferences.
  3. Go to the Security tab then in the bottom right, enter a name for the API application you're building so you can easily recognise it in the future e.g. "Llama Script".
  4. Press Enter and your API token will be shown as a 32 character ID.


image


Getting a list of servers

You can call the API through curl or via any programming language which supports HTTP requests.

Example request (curl)

curl -v -X GET https://api.serverdensity.io/inventory/devices?token=b97da80a41c4f61bff05975ee51eb1aa

You can also copy and paste https://api.serverdensity.io/inventory/devices?token=b97da80a41c4f61bff05975ee51eb1aa into your browser since it's just a GET request.

Example response

[
    {
        "_id": "51eacff476d3775722000000",
        "accountId": "51eacfc876d377471b000000",
        "agentKey": "f9ce01e1e962b59798d6350eb8cfce4c",
        "cId": "c28",
        "cpuCores": "",
        "createdAt": "2013-07-20T17:59:16",
        "deleted": false,
        "group": null,
        "hostname": "mail.sootsprite.jp",
        "installedRAM": "",
        "isMonitored": "True",
        "isNew": true,
        "lastPayloadAt": {
            "sec": 1377170228,
            "usec": 0
        },
        "location": {
            "countryCode": "gb",
            "countryName": "United Kingdom",
            "text": ""
        },
        "name": "example.com",
        "os": {
            "code": "linux",
            "name": "Linux"
        },
        "pluginsEnabled": [],
        "privateIPs": [],
        "provider": "",
        "publicIPs": [],
        "swapSpace": "",
        "type": "device",
        "updatedAt": "2013-08-22T11:17:08"
    }
]

Next steps

Use the navigation on the left to learn how to access data from your Server Density account.

Help

If you need help you can contact us with any questions - the API is fully supported so let us know if you have any problems, questions or ideas for improvement.