NAV
shell

Introduction

Welcome to the Morpheus API Documentation. Morpheus is a powerful container provisioning service complete with monitoring, logging, backups, and deployment strategies. (version 2.2.x)

We currently provide an OAUTH 2.0 based authentication model and are working on language specific libraries for ruby and a few others.

Authentication

The Morpheus API follows the OAuth 2.0 Specification and acts as an OAUTH 2.0 provider. To authorize your account you will need to use the same credentials you normally use to login to morpheus which will provide you with an accessToken as well as a refreshToken.

To authorize, use this code:

# With shell, you can just pass the correct header with each request
curl -X POST --data "username=meow&password=meow" "https://api.gomorpheus.com/oauth/token?grant_type=password&scope=write&client_id=morph-customer"

#Returns:
{
  "access_token": "d0cc2cc4-f7f5-4713-a874-34491e7707de",
  "expires_in": 31535996,
  "refresh_token": "cda88865-f88d-4ed9-a621-424d9361beb2",
  "scope": "write",
  "token_type": "bearer"
}

Make sure to replace meow with your username and password.

Morpheus expects all api requests to use the resultant access_token from the request made during authentication. This can be passed via the Authorization header. Be sure to replace the access_token with the actual token received from the OAuth request.

Authorization: BEARER access_token

Apps

Apps are groupings of instances that are linked together to form a full application stack. They can be created with existing templates or new templates, as well as from existing instances.

Current API support is limited to adding existing instances to an app

Get All Apps

curl "https://api.gomorpheus.com/api/apps"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "apps": [
    {
      "id": 1,
      "accountId": 1,
      "name": "My Test App",
      "description": "Sample Description",
      "status": "running",
      "instanceCount": 2,
      "containerCount": 2,
      "dateCreated": "2015-06-09T20:59:17Z",
      "lastUpdated": "2015-06-09T21:00:19Z",
      "appTiers": [
        {
          "tier": {
            "id": 2,
            "name": "App"
          },
          "appInstances": [
            {
              "instance": {
                "id": 53,
                "name": "Test App - Grails"
              }
            }
          ]
        },
        {
          "tier": {
            "id": 5,
            "name": "Database"
          },
          "appInstances": [
            {
              "instance": {
                "id": 54,
                "name": "Test App - MySQL"
              }
            }
          ]
        }
      ],
      "stats": {
        "usedMemory": 0,
        "maxMemory": 1073741824,
        "usedStorage": 0,
        "maxStorage": 21474836480,
        "running": 0,
        "total": 0,
        "cpuUsage": 0,
        "instanceCount": 2
      }
    }
  ],
  "meta": {
    "offset": 0,
    "max": 25,
    "size": 1,
    "total": 1
  }
}

This endpoint retrieves all apps and the correlated instances. Server data is encrypted in the database.

HTTP Request

GET https://api.gomorpheus.com/api/apps

Query Parameters

Parameter Default Description
max 25 Max number of results to return
offset 0 Offset of records you want to load
name null Filter by name
phrase null Filter by wildcard search of name and description
lastUpdated null Date filter, restricts query to only load apps updated timestamp is more recent or equal to the date specified

Get a Specific App

curl "https://api.gomorpheus.com/api/apps/4" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "app": {
    "id": 1,
    "accountId": 1,
    "name": "My Test App",
    "description": "Sample Description",
    "status": "running",
    "instanceCount": 2,
    "containerCount": 2,
    "dateCreated": "2015-06-09T20:59:17Z",
    "lastUpdated": "2015-06-09T21:00:19Z",
    "appTiers": [
      {
        "tier": {
          "id": 2,
          "name": "App"
        },
        "appInstances": [
          {
            "instance": {
              "id": 53,
              "name": "Test App - Grails"
            }
          }
        ]
      },
      {
        "tier": {
          "id": 5,
          "name": "Database"
        },
        "appInstances": [
          {
            "instance": {
              "id": 54,
              "name": "Test App - MySQL"
            }
          }
        ]
      }
    ],
    "stats": {
      "usedMemory": 0,
      "maxMemory": 1073741824,
      "usedStorage": 0,
      "maxStorage": 21474836480,
      "running": 0,
      "total": 0,
      "cpuUsage": 0,
      "instanceCount": 2
    }
  }
}

This endpoint retrieves a specific app.

HTTP Request

GET https://api.gomorpheus.com/api/apps/:id

Create an App

curl -XPOST "https://api.gomorpheus.com/api/apps" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"app":{
    "name": "sampleapp",
    "description": "A sample app",
    "site": {
      "id": 1
    }
  }}'

The above command returns JSON structured like getting a single app.

HTTP Request

POST https://api.gomorpheus.com/api/apps

JSON App Parameters

Parameter Default Description
name null A name for the app
description null Optional description field
site null A Map containing the id of the Site

Updating an App Name or Description

curl -XPUT "https://api.gomorpheus.com/api/apps/2" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"app":{
    "name": "My Sample App",
    "description": "A new description of this app",
  }}'

The above command returns JSON structured like getting a single app.

HTTP Request

PUT https://api.gomorpheus.com/api/apps/:id

JSON App Parameters

Parameter Default Description
name null A name for the app
description null Optional description field

Add Existing Instance to App

curl -XPOST "https://api.gomorpheus.com/api/apps/1/add-instance" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"instanceId": 55, tierName: "App"}'

The above command returns JSON structured like getting a single app.

HTTP Request

PUT https://api.gomorpheus.com/api/apps/:id/add-instance

JSON Parameters

Parameter Default Description
name null A name for the app
description null Optional description field

Remove Instance from App

curl -XPOST "https://api.gomorpheus.com/api/apps/1/remove-instance" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"instanceId": 55}'

The above command returns JSON structured like getting a single app.

HTTP Request

POST https://api.gomorpheus.com/api/apps/:id/remove-instance

JSON Parameters

Parameter Default Description
instanceId null The ID of the instance being added

Get Security Groups

curl -XGET "https://api.gomorpheus.com/api/apps/1/security-groups" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true,
  "firewallEnabled": true,
  "securityGroups": [
    {
      "id": 19,
      "accountId": 1,
      "name": "All Tomcat Access",
      "description": "Allow everyone to access Tomcat"
    }
  ]
}

This returns a list of all of the security groups applied to an app and whether the firewall is enabled.

HTTP Request

GET https://api.gomorpheus.com/api/apps/:id/security-groups

Set Security Groups

curl -XPOST "https://api.gomorpheus.com/api/apps/1/security-groups" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{ "securityGroupIds": [19, 2] }'

The above command returns JSON structure similar to the ‘get’ of security groups.

HTTP Request

PUT https://api.gomorpheus.com/api/apps/:id/security-groups

JSON Parameters

Parameter Default Description
securityGroupIds null List of all security groups ids which should be applied. If no security groups should apply, pass ’[]’

Disable the firewall

curl -XPUT "https://api.gomorpheus.com/api/apps/1/security-groups/disable" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true
}

This will disable the firewall. Any configured security groups will not be applied.

HTTP Request

PUT https://api.gomorpheus.com/api/apps/:id/security-groups/disable

Enable the firewall

curl -XPUT "https://api.gomorpheus.com/api/apps/1/security-groups/enable" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true
}

This will enable the firewall. Any configured security groups will be applied.

HTTP Request

PUT https://api.gomorpheus.com/api/instances/:id/security-groups/enable

Instances

Instances are sets of containers or vms (morpheus API represents a vm as a container attached to a server) of various types that can be provisioned across the Morpheus stack and offer a wide range of services. MySQL, Redis, ElasticSearch, PostgreSQL, Tomcat, nginx, Confluence, Jenkins, and more. There are a few important concept differentiators between what morpheus calls an instance and what amazon calls an instance. In morpheus an isntance can represent many vms or containers that are of a set. For example. If you wanted to spin up a Mongo sharded replicaset, that requires 7 virtual machines or 7 docker containers. Morpheus represents this as a singular instance with a specified layout and then represents all the associated services running within that instance as containers. If, a container record is a docker container then the serverId it belongs to is representative of the Docker Host it was provisioned onto. If the container is a virtual machine then the serverId represents the compute resource it was provisioned onto, (i.e. the virtual machine).

Get All Instances

curl "https://api.gomorpheus.com/api/instances?max=3"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "instances": [
    {
      "id": 1530,
      "accountId": 1,
      "instanceType": {
        "id": 35,
        "code": "ubuntu",
        "category": "os",
        "name": "Ubuntu"
      },
      "group": {
        "id": 3,
        "name": "Demo"
      },
      "cloud": {
        "id": 6,
        "name": "San Mateo VMware"
      },
      "containers": [
        1798
      ],
      "connectionInfo": [
        {
          "ip": "192.168.162.59",
          "port": 22
        }
      ],
      "layout": {
        "id": 105
      },
      "plan": {
        "id": 12,
        "code": "vm-2048"
      },
      "name": "ah-San Mateo VMware-ubuntu",
      "description": null,
      "instanceVersion": null,
      "dateCreated": "2017-01-31T21:30:49+0000",
      "lastUpdated": "2017-02-07T22:58:26+0000",
      "hostName": "ah-San-Mateo-VMware-ubuntu",
      "domainName": null,
      "environmentPrefix": null,
      "firewallEnabled": true,
      "networkLevel": "container",
      "autoScale": false,
      "instanceContext": "production",
      "currentDeployId": null,
      "status": "running",
      "statusMessage": null,
      "errorMessage": null,
      "statusDate": "2017-01-31T21:34:07+0000",
      "statusPercent": null,
      "statusEta": null,
      "userStatus": null,
      "createdBy": {
        "id": 38
      }
    },
    {
      "id": 1653,
      "accountId": 1,
      "instanceType": {
        "id": 35,
        "code": "ubuntu",
        "category": "os",
        "name": "Ubuntu"
      },
      "group": {
        "id": 3,
        "name": "Demo"
      },
      "cloud": {
        "id": 6,
        "name": "San Mateo VMware"
      },
      "containers": [
        1945
      ],
      "connectionInfo": [
        {
          "ip": "192.168.163.55",
          "port": 22
        }
      ],
      "layout": {
        "id": 105
      },
      "plan": {
        "id": 11,
        "code": "vm-1024"
      },
      "name": "ah-San Mateo VMware-ubuntu-PDNStest",
      "description": null,
      "instanceVersion": null,
      "dateCreated": "2017-02-10T14:27:42+0000",
      "lastUpdated": "2017-02-10T14:31:19+0000",
      "hostName": "ah-san-mateo-vmware-ubuntu-pdnstest",
      "domainName": null,
      "environmentPrefix": null,
      "firewallEnabled": true,
      "networkLevel": "container",
      "autoScale": false,
      "instanceContext": "dev",
      "currentDeployId": null,
      "status": "running",
      "statusMessage": null,
      "errorMessage": null,
      "statusDate": "2017-02-10T14:30:43+0000",
      "statusPercent": null,
      "statusEta": null,
      "userStatus": null,
      "createdBy": {
        "id": 38
      }
    },
    {
      "id": 1624,
      "accountId": 1,
      "instanceType": {
        "id": 21,
        "code": "apache",
        "category": "web",
        "name": "Apache"
      },
      "group": {
        "id": 163,
        "name": "snow-approvals"
      },
      "cloud": {
        "id": 6,
        "name": "San Mateo VMware"
      },
      "containers": [
        1912
      ],
      "connectionInfo": [
        {
          "ip": "192.168.163.28",
          "port": 10009
        }
      ],
      "layout": {
        "id": 48
      },
      "plan": {
        "id": 3,
        "code": "container-256"
      },
      "name": "approval-snow-test",
      "description": null,
      "instanceVersion": null,
      "dateCreated": "2017-02-09T06:45:30+0000",
      "lastUpdated": "2017-02-09T06:53:20+0000",
      "hostName": "approval-snow-test",
      "domainName": null,
      "environmentPrefix": null,
      "firewallEnabled": true,
      "networkLevel": "container",
      "autoScale": false,
      "instanceContext": null,
      "currentDeployId": null,
      "status": "running",
      "statusMessage": null,
      "errorMessage": null,
      "statusDate": "2017-02-09T06:53:20+0000",
      "statusPercent": null,
      "statusEta": null,
      "userStatus": null,
      "createdBy": {
        "id": 25
      }
    }
  ],
  "stats": {
    "1530": {
      "usedStorage": 6776664064,
      "maxStorage": 21067075584,
      "usedMemory": 1909739520,
      "maxMemory": 2098315264,
      "usedCpu": 1.0926682792
    },
    "1653": {
      "usedStorage": 2662801408,
      "maxStorage": 10499452928,
      "usedMemory": 935444480,
      "maxMemory": 1041350656,
      "usedCpu": 0.1501000667
    },
    "1624": {
      "usedStorage": 4829184,
      "maxStorage": 3103539200,
      "usedMemory": 9113600,
      "maxMemory": 268435456,
      "usedCpu": 0
    }
  },
  "loadBalancers": [],
  "meta": {
    "offset": 0,
    "max": "3",
    "size": 3,
    "total": 21
  }
}

This endpoint retrieves all instances and their JSON encoded configuration attributes based on check type. Server data is encrypted in the database.

HTTP Request

GET https://api.gomorpheus.com/api/instances

Query Parameters

Parameter Default Description
max 25 Max number of results to return
offset 0 Offset of records you want to load
lastUpdated null Date filter, restricts query to only load instances updated timestamp is more recent or equal to the date specified

Get a Specific Instance

curl "https://api.gomorpheus.com/api/instances/1216" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "success": true,
  "instance": {
    "id": 1698,
    "accountId": 1,
    "instanceType": {
      "id": 44,
      "code": "redis",
      "category": "cache",
      "name": "Redis"
    },
    "group": {
      "id": 3,
      "name": "Demo"
    },
    "cloud": {
      "id": 6,
      "name": "San Mateo VMware"
    },
    "containers": [
      19
    ],
    "connectionInfo": [
      {
        "ip": "10.211.55.11",
        "port": 10000
      }
    ],
    "layout": {
      "id": 221
    },
    "plan": {
      "id": 69,
      "code": "container-512"
    },
    "name": "redistest",
    "description": null,
    "instanceVersion": null,
    "tags": [

    ],
    "maxMemory": 536870912,
    "maxStorage": 5368709120,
    "maxCores": 0,
    "maxCpu": null,
    "dateCreated": "2016-10-25T15:12:06+0000",
    "lastUpdated": "2017-02-13T19:22:00+0000",
    "hostName": "redistest",
    "domainName": null,
    "environmentPrefix": null,
    "firewallEnabled": true,
    "networkLevel": "container",
    "autoScale": false,
    "instanceContext": null,
    "currentDeployId": null,
    "status": "running",
    "statusMessage": null,
    "errorMessage": null,
    "statusDate": "2016-10-25T15:12:41+0000",
    "statusPercent": null,
    "statusEta": null,
    "userStatus": null,
    "createdBy": {
      "id": 1
    }
  },
  "stats": {
    "usedStorage": 2951,
    "maxStorage": 1073741824,
    "usedMemory": 266240,
    "maxMemory": 268435456,
    "usedCpu": 0.0418375032
  }
}

This endpoint retrieves a specific instance.

HTTP Request

GET https://api.gomorpheus.com/api/instances/:id

Get env variables

curl "https://api.gomorpheus.com/api/instances/1216/envs" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "envs": [
    {
      "export": false,
      "masked": false,
      "name": "DATABASE_NAME",
      "value": "spud_marketing"
    }
  ],
  "readOnlyEnvs": {
    "TOMCAT_HOST": {
      "export": true,
      "masked": false,
      "name": "TOMCAT_HOST",
      "value": "container1414"
    },
    "TOMCAT_HOST_2": {
      "export": true,
      "masked": false,
      "name": "TOMCAT_HOST_2",
      "value": "container1759"
    },
    "TOMCAT_IP": {
      "export": true,
      "masked": false,
      "name": "TOMCAT_IP",
      "value": "192.168.163.232"
    },
    "TOMCAT_IP_2": {
      "export": true,
      "masked": false,
      "name": "TOMCAT_IP_2",
      "value": "192.168.163.233"
    },
    "TOMCAT_PORT": {
      "export": true,
      "masked": false,
      "name": "TOMCAT_PORT",
      "value": 10017
    },
    "TOMCAT_PORT_2": {
      "export": true,
      "masked": false,
      "name": "TOMCAT_PORT_2",
      "value": 10017
    },
    "TOMCAT_PORT_8080_TCP": {
      "export": true,
      "masked": false,
      "name": "TOMCAT_PORT_8080_TCP",
      "value": "tcp://192.168.163.232:10017"
    },
    "TOMCAT_PORT_8080_TCP_2": {
      "export": true,
      "masked": false,
      "name": "TOMCAT_PORT_8080_TCP_2",
      "value": "tcp://192.168.163.233:10017"
    },
    "TOMCAT_PORT_8080_TCP_ADDR": {
      "export": true,
      "masked": false,
      "name": "TOMCAT_PORT_8080_TCP_ADDR",
      "value": "192.168.163.232"
    },
    "TOMCAT_PORT_8080_TCP_ADDR_2": {
      "export": true,
      "masked": false,
      "name": "TOMCAT_PORT_8080_TCP_ADDR_2",
      "value": "192.168.163.233"
    },
    "TOMCAT_PORT_8080_TCP_PORT": {
      "export": true,
      "masked": false,
      "name": "TOMCAT_PORT_8080_TCP_PORT",
      "value": 10017
    },
    "TOMCAT_PORT_8080_TCP_PORT_2": {
      "export": true,
      "masked": false,
      "name": "TOMCAT_PORT_8080_TCP_PORT_2",
      "value": 10017
    },
    "TOMCAT_PORT_8080_TCP_PROTO": {
      "export": true,
      "masked": false,
      "name": "TOMCAT_PORT_8080_TCP_PROTO",
      "value": "tcp"
    },
    "TOMCAT_PORT_8080_TCP_PROTO_2": {
      "export": true,
      "masked": false,
      "name": "TOMCAT_PORT_8080_TCP_PROTO_2",
      "value": "tcp"
    }
  },
  "importedEnvs": {
    "MYSQL_HOST": {
      "export": true,
      "masked": false,
      "name": "MYSQL_HOST",
      "value": "container1413"
    },
    "MYSQL_HOST_2": {
      "export": true,
      "masked": false,
      "name": "MYSQL_HOST_2",
      "value": "container1756"
    },
    "MYSQL_IP": {
      "export": true,
      "masked": false,
      "name": "MYSQL_IP",
      "value": "192.168.163.232"
    },
    "MYSQL_IP_2": {
      "export": true,
      "masked": false,
      "name": "MYSQL_IP_2",
      "value": "192.168.163.233"
    },
    "MYSQL_MASTER": {
      "export": true,
      "masked": false,
      "name": "MYSQL_HOST",
      "value": "container1413"
    },
    "MYSQL_PASSWORD": {
      "export": true,
      "masked": true,
      "name": "MYSQL_PASSWORD",
      "value": "morpheus"
    },
    "MYSQL_PASSWORD_2": {
      "export": true,
      "masked": true,
      "name": "MYSQL_PASSWORD",
      "value": "morpheus"
    },
    "MYSQL_PORT": {
      "export": true,
      "masked": false,
      "name": "MYSQL_PORT",
      "value": 10016
    },
    "MYSQL_PORT_2": {
      "export": true,
      "masked": false,
      "name": "MYSQL_PORT_2",
      "value": 10016
    },
    "MYSQL_PORT_3306_TCP": {
      "export": true,
      "masked": false,
      "name": "MYSQL_PORT_3306_TCP",
      "value": "tcp://192.168.163.232:10016"
    },
    "MYSQL_PORT_3306_TCP_2": {
      "export": true,
      "masked": false,
      "name": "MYSQL_PORT_3306_TCP_2",
      "value": "tcp://192.168.163.233:10016"
    },
    "MYSQL_PORT_3306_TCP_ADDR": {
      "export": true,
      "masked": false,
      "name": "MYSQL_PORT_3306_TCP_ADDR",
      "value": "192.168.163.232"
    },
    "MYSQL_PORT_3306_TCP_ADDR_2": {
      "export": true,
      "masked": false,
      "name": "MYSQL_PORT_3306_TCP_ADDR_2",
      "value": "192.168.163.233"
    },
    "MYSQL_PORT_3306_TCP_PORT": {
      "export": true,
      "masked": false,
      "name": "MYSQL_PORT_3306_TCP_PORT",
      "value": 10016
    },
    "MYSQL_PORT_3306_TCP_PORT_2": {
      "export": true,
      "masked": false,
      "name": "MYSQL_PORT_3306_TCP_PORT_2",
      "value": 10016
    },
    "MYSQL_PORT_3306_TCP_PROTO": {
      "export": true,
      "masked": false,
      "name": "MYSQL_PORT_3306_TCP_PROTO",
      "value": "tcp"
    },
    "MYSQL_PORT_3306_TCP_PROTO_2": {
      "export": true,
      "masked": false,
      "name": "MYSQL_PORT_3306_TCP_PROTO_2",
      "value": "tcp"
    },
    "MYSQL_USERNAME": "morpheus",
    "MYSQL_USERNAME_2": "morpheus"
  }
}

This gets all the environment variables associated with the instance.

HTTP Request

GET https://api.gomorpheus.com/api/instances/:id/envs

Get Security Groups

curl "https://api.gomorpheus.com/api/instances/1666/security-groups" \
  -H "Authorization: BEARER access_token"

The above command returns JSON like this:

{
  "success": true,
  "firewallEnabled": true,
  "securityGroups": [
    {
      "id": 43,
      "accountId": 1,
      "name": "api-tom-test",
      "description": "Test Security Group"
    }
  ]
}

This gets information about the security groups the instance has setup.

HTTP Request

GET https://api.gomorpheus.com/api/instances/:id/security-groups

Enable security-groups

curl -X PUT "https://api.gomorpheus.com/api/instances/1666/security-groups/enable" \
  -H "Authorization: BEARER access_token"

The above command returns JSON like this:

{
  "success": true
}

This action enables a security group assigned to an instance

HTTP Request

PUT https://api.gomorpheus.com/api/instances/:id/security-groups/enable

Disable security-groups

curl -X PUT "https://api.gomorpheus.com/api/instances/1666/security-groups/disable" \
  -H "Authorization: BEARER access_token"

The above command returns JSON like this:

{
  "success": true
}

HTTP Request

PUT https://api.gomorpheus.com/api/instances/:id/security-groups/disable

Get container details

curl "https://api.gomorpheus.com/api/instances/1216/containers" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "success": true,
  "containers": [
    {
      "id": 1414,
      "name": "tomcat_1414",
      "configs": "{\"evars\":{},\"hosts\":{\"container1414\":\"127.0.0.1\",\"container1759\":\"192.168.163.233\"},\"maxMemory\":1073741824,\"maxStorage\":10737418240,\"mounts\":[{\"containerPath\":\"/morpheus/data\",\"hostPath\":\"/morpheus/container_1414/data\",\"type\":\"data\"},{\"containerPath\":\"/morpheus/logs\",\"hostPath\":\"/morpheus/container_1414/logs\",\"type\":\"logs\"},{\"containerPath\":\"/morpheus/config\",\"hostPath\":\"/morpheus/container_1414/config\",\"type\":\"config\"}],\"ports\":[{\"displayName\":\"Http\",\"export\":true,\"exportName\":null,\"external\":10017,\"index\":0,\"internal\":8080,\"link\":true,\"loadBalance\":true,\"protocol\":\"http\",\"visible\":true}],\"priviligedContainer\":null,\"vm\":false}",
      "containerType": {
        "id": 23,
        "name": "Tomcat 7.0.62"
      },
      "lastStats": "{\"ts\":\"2017-02-11T17:54:30+0000\",\"maxStorage\":10434699264,\"usedStorage\":290037760,\"running\":true,\"userCpuUsage\":0,\"systemCpuUsage\":0.0062528659,\"usedMemory\":770224128,\"maxMemory\":1073741824,\"cacheMemory\":275013632,\"readIOPS\":0,\"writeIOPS\":0,\"totalIOPS\":0,\"netTxUsage\":0,\"netRxUsage\":0}",
      "environmentPrefix": null,
      "status": "running",
      "dateCreated": "2016-12-15T15:22:17Z",
      "ip": "12.96.81.102",
      "externalIp": "12.96.81.102",
      "internalIp": "192.168.163.232",
      "ports": [
        {
          "displayName": "Http",
          "export": true,
          "exportName": null,
          "external": 10017,
          "index": 0,
          "internal": 8080,
          "link": true,
          "loadBalance": true,
          "protocol": "http",
          "visible": true
        }
      ]
    },
    {
      "id": 1759,
      "name": "tomcat_1759",
      "configs": "{\"evars\":{},\"hosts\":{\"container1414\":\"192.168.163.232\",\"container1759\":\"127.0.0.1\"},\"maxMemory\":1073741824,\"maxStorage\":10737418240,\"mounts\":[{\"containerPath\":\"/morpheus/data\",\"hostPath\":\"/morpheus/container_1759/data\",\"type\":\"data\"},{\"containerPath\":\"/morpheus/logs\",\"hostPath\":\"/morpheus/container_1759/logs\",\"type\":\"logs\"},{\"containerPath\":\"/morpheus/config\",\"hostPath\":\"/morpheus/container_1759/config\",\"type\":\"config\"}],\"networkInterfaces\":null,\"ports\":[{\"code\":\"tomcat.8080\",\"displayName\":\"Http\",\"export\":true,\"exportName\":null,\"external\":10017,\"index\":0,\"internal\":8080,\"link\":true,\"loadBalance\":true,\"protocol\":\"http\",\"visible\":true}],\"priviligedContainer\":null,\"serverId\":null,\"storageController\":null,\"vm\":false,\"volumes\":null}",
      "containerType": {
        "id": 23,
        "name": "Tomcat 7.0.62"
      },
      "lastStats": "{\"ts\":\"2017-02-11T17:53:39+0000\",\"maxStorage\":10434699264,\"usedStorage\":288571392,\"running\":true,\"userCpuUsage\":0.0062526053,\"systemCpuUsage\":0.008336807,\"usedMemory\":790220800,\"maxMemory\":1073741824,\"cacheMemory\":190226432,\"readIOPS\":0,\"writeIOPS\":0,\"totalIOPS\":0,\"netTxUsage\":0,\"netRxUsage\":0}",
      "environmentPrefix": null,
      "status": "running",
      "dateCreated": "2017-01-27T19:29:39Z",
      "ip": "12.96.81.103",
      "externalIp": "12.96.81.103",
      "internalIp": "192.168.163.233",
      "ports": [
        {
          "code": "tomcat.8080",
          "displayName": "Http",
          "export": true,
          "exportName": null,
          "external": 10017,
          "index": 0,
          "internal": 8080,
          "link": true,
          "loadBalance": true,
          "protocol": "http",
          "visible": true
        }
      ]
    }
  ]
}

This can be valuable for evaluating the details of the compute server(s) running on an instance

HTTP Request

GET https://api.gomorpheus.com/api/instances/:id/containers

Create an Instance

See Provisioning for details.

HTTP Request

POST https://api.gomorpheus.com/api/instances

Updating an Instance

curl -X PUT "https://api.gomorpheus.com/api/instances/1" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{ "instance": {
  "name": "my new redis",
  "description": "my new redis"
  }}'

The above command returns a similar JSON structure when submitting a GET request for a single check

HTTP Request

PUT https://api.gomorpheus.com/api/instances/:id

JSON Instance Parameters

Parameter Default Description
name null Unique name scoped to your account for the instance
description null Optional description field

Stop an Instance

curl -X PUT "https://api.gomorpheus.com/api/instances/1/stop" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true
}

This will stop all containers running within an instance.

HTTP Request

PUT https://api.gomorpheus.com/api/instances/:id/stop

Start an Instance

curl -X PUT "https://api.gomorpheus.com/api/instances/1/start" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true
}

This will start all containers running within an instance.

HTTP Request

PUT https://api.gomorpheus.com/api/instances/:id/start

Restart an Instance

curl -X PUT "https://api.gomorpheus.com/api/instances/1/restart" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true
}

This will restart all containers running within an instance. This includes rebuilding the environment variables and applying settings to the docker containers.

HTTP Request

PUT https://api.gomorpheus.com/api/instances/:id/restart

Suspend an Instance

curl -X PUT "https://api.gomorpheus.com/api/instances/1/suspend" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true
}

This will suspend all containers in the instance.

HTTP Request

PUT https://api.gomorpheus.com/api/instances/:id/eject

Eject an Instance

curl -X PUT "https://api.gomorpheus.com/api/instances/1/eject" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true
}

This will eject any ISO media on all containers in the instance.

HTTP Request

PUT https://api.gomorpheus.com/api/instances/:id/eject

Resize an Instance

curl -X PUT "https://api.gomorpheus.com/api/instances/1/resize" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{
  "instance": {
    "id": 1,
    "plan": {
      "id": 15
    }
  },
  "volumes": [
    {
      "id": "-1",
      "rootVolume": true,
      "name": "root",
      "size": 20,
      "sizeId": null,
      "storageType": null,
      "datastoreId": null
    }
  ],
  "deleteOriginalVolumes": true
}'

The above command returns JSON structure like this:

{
  "success": true
}

It is possible to resize containers within an instance by increasing their memory plan or storage limit. This is done by assigning a new service plan to the container.

HTTP Request

PUT https://api.gomorpheus.com/api/instances/:id/resize

JSON Parameters

Parameter Required Default Description
instance.plan.id no null The map containing the id of the service plan you wish to apply to the containers in this instance
volumes no defaults to plan config Can be used to grow just the logical volume of the instance instead of choosing a plan
deleteOriginalVolumes no false Delete the original volumes after resizing. (Amazon only)

Clone an Instance

curl -X PUT "https://api.gomorpheus.com/api/instances/1/clone" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{ "name": "New Name",
    "group": {
      "id": 1
  }}'

The above command returns JSON structure like this:

{
  "success": true
}

One can easily clone an instance and all containers within that instance. The containers are backed up via the backup services and used as a snapshot to produce a clone of the instance. It is possible to clone this app instance into an entirely different availability zone.

HTTP Request

PUT https://api.gomorpheus.com/api/instances/:id/clone

JSON Parameters

Parameter Default Description
group null the map containing the id of the server group you would like to clone into.
name null A name for the new cloned instance. If none is specified the existing name will be duplicated with the ‘clone’ suffix added.

Upgrade an Instance

curl -X PUT "https://api.gomorpheus.com/api/instances/1/upgrade" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{ "upgrade": {
      "id": 1
  }}'

The above command returns JSON structure like this:

{
  "success": true
}

It is possible to perform certain upgrade options for an instance. See the section on getting a list of upgrade options for a particular instance. Depending on the instance type these could include adding a replica, adding a a tomcat node, adding a mysql save, or master. Entirely depends.

HTTP Request

PUT https://api.gomorpheus.com/api/instances/:id/upgrade

JSON Parameters

Parameter Default Description
upgrade null the map containing the id of the instance type upgrade you would like to perform.

Backup an Instance

curl -X PUT "https://api.gomorpheus.com/api/instances/1773/backup" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure that looks like this:

{
    "success": true
}

HTTP Request

PUT https://api.gomorpheus.com/api/instances/:id/backup

Get list of backups for an Instance

curl "https://api.gomorpheus.com/api/instances/1773/backups" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure that looks like this:

{
    "instance": {
      "id": 1773
    },
    "backups": [
    ]
}

HTTP Request

GET https://api.gomorpheus.com/api/instances/:id/backups

Import Snapshot of an Instance

curl -X PUT "https://api.gomorpheus.com/api/instances/1/import-snapshot" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{ "storageProviderId": 1
  }'

The above command returns JSON structure like this:

{
  "success": true
}

It is possible to import a snapshot of an instance. This creates a Virtual Image of the instance as it currently exists.

HTTP Request

PUT https://api.gomorpheus.com/api/instances/:id/import-snapshot

JSON Parameters

Parameter Default Description
storageProviderId null Optional storage provider to use.

Delete an Instance

curl -XDELETE "https://api.gomorpheus.com/api/instances/1" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true
}

Will delete an instance and all associated monitors and backups.

HTTP Request

DELETE https://api.gomorpheus.com/api/instances/:id

Get Security Groups

curl -XGET "https://api.gomorpheus.com/api/instances/1/security-groups" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true,
  "firewallEnabled": true,
  "securityGroups": [
    {
      "id": 19,
      "accountId": 1,
      "name": "All Tomcat Access",
      "description": "Allow everyone to access Tomcat"
    }
  ]
}

This returns a list of all of the security groups applied to an instance and whether the firewall is enabled.

HTTP Request

GET https://api.gomorpheus.com/api/instances/:id/security-groups

Set Security Groups

curl -X POST "https://api.gomorpheus.com/api/instances/1/security-groups" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{ "securityGroupIds": [19, 2] }'

The above command returns JSON structure similar to the 'get’ of security groups.

HTTP Request

PUT https://api.gomorpheus.com/api/instances/:id/security-groups

JSON Parameters

Parameter Default Description
securityGroupIds null List of all security groups ids which should be applied. If no security groups should apply, pass ’[]’

Disable the firewall

curl -X PUT "https://api.gomorpheus.com/api/instances/1/security-groups/disable" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true
}

This will disable the firewall. Any configured security groups will not be applied.

HTTP Request

PUT https://api.gomorpheus.com/api/instances/:id/security-groups/disable

Enable the firewall

curl -X PUT "https://api.gomorpheus.com/api/instances/1/security-groups/enable" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true
}

This will enable the firewall. Any configured security groups will be applied.

HTTP Request

PUT https://api.gomorpheus.com/api/instances/:id/security-groups/enable

Instance Types

Provides a means to find out which instance types are available to your user account. These can vary in range from database containers, to web containers, to custom containers. .

Get All Instance Types

curl "https://api.gomorpheus.com/api/instance-types"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this

{
  "instanceTypes": [
    {
      "id": 12,
      "name": "ActiveMQ",
      "code": "activemq",
      "category": "messaging",
      "active": true,
      "versions": [
        "5.11"
      ],
      "instanceTypeLayouts": [
        {
          "id": 14,
          "code": "activemq-5.11",
          "name": "Single Process",
          "description": "This will provision a single process with no redundancy",
          "provisionType": { /* see provision types */ },
          "optionTypes": { /** see option types **/}
        }
      ]
    },
    {
      "id": 13,
      "name": "Cassandra",
      "code": "cassandra",
      "category": "nosql",
      "active": true,
      "versions": [
        "2.1"
      ],
      "instanceTypeLayouts": [
        {
          "id": 15,
          "code": "cassandra-2.1-single",
          "name": "Single Process",
          "description": "This will provision a single process with no redundancy",
          "provisionType": { /* see provision types */ },
          "optionTypes": { /** see option types **/ }
        }
      ]
    },
    {
      "id": 10,
      "name": "Confluence",
      "code": "confluence",
      "category": "utils",
      "active": true,
      "versions": [
        "5.7"
      ],
      "instanceTypeLayouts": [
        {
          "id": 12,
          "code": "confluence-5.7",
          "name": "Single Process",
          "description": "This will provision a single process with no redundancy",
          "provisionType": { /* see provision types */ },
          "optionTypes": { /** see option types **/ }
        }
      ]
    },
    {
      "id": 5,
      "name": "Elastic Search",
      "code": "elasticsearch",
      "category": "nosql",
      "active": true,
      "versions": [
        "1.5"
      ],
      "instanceTypeLayouts": [
        {
          "id": 3,
          "code": "elasticsearch-1.5-single",
          "name": "Single Process",
          "description": "This will provision a single process with no redundancy",
          "provisionType": { /* see provision types */ },
          "optionTypes": { /** see option types **/ }
        },
        {
          "id": 4,
          "code": "elasticsearch-1.5-cluster",
          "name": "Cluster",
          "description": "This will provision two nodes, in multi master cluster",
          "provisionType": { /* see provision types */ },
          "optionTypes": { /** see option types **/ }
        }
      ]
    },
    {
      "id": 7,
      "name": "Jenkins",
      "code": "jenkins",
      "category": "utils",
      "active": true,
      "versions": [
        "1.596"
      ],
      "instanceTypeLayouts": [
        {
          "id": 8,
          "code": "jenkins-1.596",
          "name": "Single Process",
          "description": "This will provision a single process with no redundancy",
          "provisionType": { /* see provision types */ },
          "optionTypes": { /** see option types **/ }
        }
      ]
    },
    {
      "id": 2,
      "name": "Memcached",
      "code": "memcached",
      "category": "cache",
      "active": true,
      "versions": [
        "1.4"
      ],
      "instanceTypeLayouts": [
        {
          "id": 11,
          "code": "memcached-1.4-single",
          "name": "Single Process",
          "description": "This will provision a single process with no redundancy",
          "provisionType": { /* see provision types */ },
          "optionTypes": { /** see option types **/ }
        }
      ]
    },
    {
      "id": 4,
      "name": "Mongo",
      "code": "mongo",
      "category": "nosql",
      "active": true,
      "versions": [
        "3.0"
      ],
      "instanceTypeLayouts": [
        {
          "id": 16,
          "code": "mongo-3.0-rs",
          "name": "ReplicaSet",
          "description": "This will provision a 3 node replicaSet",
          "provisionType": { /* see provision types */ },
          "optionTypes": { /** see option types **/ }
        },
        {
          "id": 6,
          "code": "mongo-3.0-single",
          "name": "Single Process",
          "description": "This will provision a single process with no redundancy",
          "provisionType": { /* see provision types */ },
          "optionTypes": { /** see option types **/ }
        }
      ]
    },
    {
      "id": 3,
      "name": "MySQL",
      "code": "mysql",
      "category": "sql",
      "active": true,
      "versions": [
        "5.6"
      ],
      "instanceTypeLayouts": [
        {
          "id": 5,
          "code": "mysql-5.6-single",
          "name": "Single Process",
          "description": "This will provision a single process with no redundancy",
          "provisionType": { /* see provision types */ },
          "optionTypes": { /** see option types **/ }
        }
      ]
    },
    {
      "id": 8,
      "name": "Nexus",
      "code": "nexus",
      "category": "utils",
      "active": true,
      "versions": [
        "2.11"
      ],
      "instanceTypeLayouts": [
        {
          "id": 9,
          "code": "nexus-2.11",
          "name": "Single Process",
          "description": "This will provision a single process with no redundancy",
          "provisionType": { /* see provision types */ },
          "optionTypes": { /** see option types **/ }
        }
      ]
    },
    {
      "id": 14,
      "name": "Nginx",
      "code": "nginx",
      "category": "web",
      "active": true,
      "versions": [
        "1.9"
      ],
      "instanceTypeLayouts": [

      ]
    },
    {
      "id": 11,
      "name": "Postgres",
      "code": "postgres",
      "category": "sql",
      "active": true,
      "versions": [
        "9.4"
      ],
      "instanceTypeLayouts": [
        {
          "id": 13,
          "code": "postgres-9.4-single",
          "name": "Single Process",
          "description": "This will provision a single process with no redundancy",
          "provisionType": { /* see provision types */ },
          "optionTypes": { /** see option types **/ }
        }
      ]
    },
    {
      "id": 9,
      "name": "RabbitMQ",
      "code": "rabbitmq",
      "category": "utils",
      "active": true,
      "versions": [
        "3.5"
      ],
      "instanceTypeLayouts": [
        {
          "id": 10,
          "code": "rabbitmq-3.5",
          "name": "Single Process",
          "description": "This will provision a single process with no redundancy",
          "provisionType": { /* see provision types */ },
          "optionTypes": { /** see option types **/ }
        }
      ]
    },
    {
      "id": 1,
      "name": "Redis",
      "code": "redis",
      "category": "cache",
      "active": true,
      "versions": [
        "3.0"
      ],
      "instanceTypeLayouts": [
        {
          "id": 1,
          "code": "redis-3.0-single",
          "name": "Single Process",
          "description": "This will provision a single process with no redundancy",
          "provisionType": { /* see provision types */ },
          "optionTypes": { /** see option types **/ }
        },
        {
          "id": 2,
          "code": "redis-3.0-master-slave",
          "name": "Master\/Slave",
          "description": "This will provision 2 containers, one master and 1 slave.",
          "provisionType": { /* see provision types */ },
          "optionTypes": { /** see option types **/ }
        }
      ]
    },
    {
      "id": 6,
      "name": "Tomcat",
      "code": "tomcat",
      "category": "web",
      "active": true,
      "versions": [
        "7.0.62"
      ],
      "instanceTypeLayouts": [
        {
          "id": 7,
          "code": "tomcat-7.0.62-single",
          "name": "Single Process",
          "description": "This will provision a single process with no redundancy",
          "provisionType": { /* see provision types */ },
          "optionTypes": { /** see option types **/ }
        }
      ]
    }
  ]
}

HTTP Request

GET https://api.gomorpheus.com/api/instance-types

Get Specific Instance Type

curl "https://api.gomorpheus.com/api/instance-types/12"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this

{
  "success": true,
  "instanceType": {
    "id": 12,
    "name": "ActiveMQ",
    "code": "activemq",
    "category": "messaging",
    "active": true,
    "versions": [
      "5.11"
    ],
    "instanceTypeLayouts": [
      {
        "id": 14,
        "code": "activemq-5.11",
        "name": "Single Process",
        "description": "This will provision a single process with no redundancy",
        "provisionType": { /* see provision types */ },
        "optionTypes": { /** see option types **/ }
      }
    ]
  }
}

HTTP Request

GET https://api.gomorpheus.com/api/instance-types/:id

Get Upgrade Options

curl "https://api.gomorpheus.com/api/instance-types/upgrades/1"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this

{
  "upgrades": [
    {
      "id": 3,
      "code": "tomcat-add-node",
      "containerTypes": null,
      "description": "This will add an additional tomcat node",
      "name": "Add Tomcat Node",
      "sortOrder": 0
    }
  ]
}

HTTP Request

GET https://api.gomorpheus.com/api/instance-types/upgrades/:layout_id

Provisioning

Provisioning options will depend heavily on the cloud you are provisioning to. This section is broken out into options based on the instance-type that is being created.

Provision an Instance

curl -X POST "https://api.gomorpheus.com/api/instances" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{
  "zoneId": 6,
  "instance": {
    "name": "api-testing2",
    "site": {
      "id": 3
    },
    "instanceType": {
      "code": "Ubuntu"
    },
    "layout": {
      "id": 105
    },
    "plan": {
      "id": 75
    }
  },
  "volumes": [
    {
      "id": -1,
      "rootVolume": true,
      "name": "root",
      "size": 10,
      "sizeId": null,
      "storageType": 1,
      "datastoreId": "auto"
    },
    {
      "id": -1,
      "rootVolume": false,
      "name": "data",
      "size": 5,
      "sizeId": null,
      "storageType": 1,
      "datastoreId": "auto"
    }
  ],
  "networkInterfaces": [
    {
      "network": {
        "id": 5
      },
      "networkInterfaceTypeId": 4
    }
  ],
  config: {
    "publicKeyId": 14,
    "vmwareResourcePoolId": "resgroup-56",
    "hostId": null,
    "vmwareUsr": "morpheus-api",
    "vmwarePwd": "password",
    "vmwareDomainName": null,
    "vmwareCustomSpec": null
  },
  evars: [
    {"name": "MY_APP_VAR1", "value": "VALUE1"},
    {"name": "MY_APP_VAR2", "value": "VALUE2"}
  ],
}'

The above command returns a similar JSON structure when submitting a GET request for a single check

HTTP Request

POST https://api.gomorpheus.com/api/instances

JSON Parameters

Parameter Required Default Description
instance Y n/a Key for name, site, instanceType layout, and plan
instance.name Y null Name of the instance to be created
instance.site.id Y null The Group ID to provision the instance into
instance.instanceType.code Y null The type of instance by code we want to fetch
instance.layout.id Y null The layout id for the instance type that you want to provision. i.e. single process or cluster
instance.plan.id Y null The id for the memory and storage option pre-configured within Morpheus
zoneId Y null The Cloud ID to provision the instance onto
evars N [] Environment Variables, an array of objects that have name and value.
copies N 1 Number of copies to provision
layoutSize N 1 Apply a multiply factor of containers/vms within the instance
servicePlanOptions N null Map of custom options depending on selected service plan . An example would be maxMemory, or maxCores.
securityGroups N null Key for security group configuration. It should be passed as an array of objects containing the id of the security group to assign the instance to
volumes N null Key for volume configuration, see Volumes
networkInterfaces N null Key for network configuration, see Network Interfaces
config Y null Key for specific type configuration, see Config

Volumes

The (optional) volumes parameter is for LV configuration, can create additional LVs at provision It should be passed as an array of Objects with the following attributes:

Parameter Required Default Description
id N -1 The id for the LV configuration being created
rootVolume N true If set to false then a non-root LV will be created
name Y root Name/type of the LV being created
size N [from service plan] Size of the LV to be created in GBs
sizeId N null Can be used to select pre-existing LV choices from Morpheus
storageType N null Identifier for LV type
datastoreId Y null The ID of the specific datastore

Network Interfaces

The networkInterfaces parameter is for network configuration.

The Options API /api/options/zoneNetworkOptions?zoneId=5&provisionTypeId=10 can be used to see which options are available.

It should be passed as an array of Objects with the following attributes:

Parameter Required Default Description
network.id Y n/a id of the network to be used.
networkInterfaceTypeId Y n/a The id of type of the network interface.
ipAddress Y n/a The ip address. Not applicable when using DHCP or IP Pools.

Config

The config parameter is for configuration options that are specific to each Provision Type. The Provision Types api can be used to see which options are available.

JSON Config Parameters for VMware
Parameter Required Default Description
publicKeyId N null ID of a public key to add to the instance
vmwareResourcePoolId Y null ID of the resource group to use for instance
hostId N null Specific host to deploy to if so desired
vmwareUsr N null Additional user to provision to instance
vmwarePwd N null Password for additional user
vmwareDomainName N null Domain name to be given to instance
vmwareCustomSpec N null Customization spec ID

Documentation on ALL of the provision types to come…

There can be additional properties to apply to the instance. For example mysql provisioning requires a set of initial credentials. You can get a list of what these input options are by fetching the instance-types list via the instance-types api and getting available layouts as well as the provision type option types associated with the layout. Currently these input options are available from the option-types map. These however, can be overridden in the event a config options map exists on the layout object within. NOTE: See the API Document on OptionTypes for figuring out how to build property maps from them.

Provision Types

Morpheus supports a diverse set of cloud APIS for provisioning compute and services. In order to facilitate some of these capabilities and preserve some of the diverse sets of feature sets across these plaforms it is necessary to provide a means to dynamicaly specifying provisioning options depending on what is being provisioned. Morpheus calls these provision-types. Each InstanceTypeLayout that can be provisioned has a correlating ProvisionType and each CloudType (aka ZoneType) has a list of supported provision types it is capable of provisioning. This record contains optionTypes (see section on optionTypes for specifics on how to parse this data) as well as information for building out network parameters and storage parameters by listing different storage type information.

Get All Provision Types

curl "https://api.gomorpheus.com/api/provision-types"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this

{
    "provisionTypes": [
        {
            "id": 9,
            "name": "Amazon",
            "description": null,
            "code": "amazon",
            "aclEnabled": false,
            "multiTenant": false,
            "managed": true,
            "hostNetwork": true,
            "customSupported": false,
            "mapPorts": false,
            "exportServer": null,
            "viewSet": "amazonCustom",
            "serverType": "ami",
            "hostType": "vm",
            "addVolumes": true,
            "hasDatastore": false,
            "hasNetworks": null,
            "maxNetworks": null,
            "customizeVolume": true,
            "rootDiskCustomizable": true,
            "lvmSupported": true,
            "hostDiskMode": "lvm",
            "minDisk": 0,
            "maxDisk": null,
            "resizeCopiesVolumes": true,
            "optionTypes": [
                {
                    "name": "subnet",
                    "description": null,
                    "fieldName": "subnetId",
                    "fieldLabel": "Subnet",
                    "fieldContext": "config",
                    "fieldAddOn": null,
                    "placeHolder": null,
                    "helpBlock": "",
                    "defaultValue": null,
                    "optionSource": "amazonSubnet",
                    "type": "select",
                    "advanced": false,
                    "required": true,
                    "editable": false,
                    "config": [],
                    "displayOrder": 100
                },
                {
                    "name": "security group",
                    "description": null,
                    "fieldName": "securityId",
                    "fieldLabel": "Security Group",
                    "fieldContext": "config",
                    "fieldAddOn": null,
                    "placeHolder": null,
                    "helpBlock": "",
                    "defaultValue": null,
                    "optionSource": "amazonSecurityGroup",
                    "type": "select",
                    "advanced": false,
                    "required": true,
                    "editable": false,
                    "config": [],
                    "displayOrder": 101
                },
                {
                    "name": "public key",
                    "description": null,
                    "fieldName": "publicKeyId",
                    "fieldLabel": "Public Key",
                    "fieldContext": "config",
                    "fieldAddOn": null,
                    "placeHolder": null,
                    "helpBlock": "",
                    "defaultValue": null,
                    "optionSource": "keyPairs",
                    "type": "select",
                    "advanced": false,
                    "required": false,
                    "editable": false,
                    "config": [],
                    "displayOrder": 9
                }
            ],
            "customOptionTypes": [],
            "networkTypes": [],
            "storageTypes": [
                {
                    "id": 7,
                    "code": "amazon-sc1",
                    "name": "sc1",
                    "displayOrder": 4,
                    "defaultType": false,
                    "customLabel": true,
                    "customSize": true,
                    "customSizeOptions": null
                },
                {
                    "id": 4,
                    "code": "amazon-io1",
                    "name": "io1",
                    "displayOrder": 2,
                    "defaultType": false,
                    "customLabel": true,
                    "customSize": true,
                    "customSizeOptions": null
                },
                {
                    "id": 5,
                    "code": "amazon-gp2",
                    "name": "gp2",
                    "displayOrder": 1,
                    "defaultType": true,
                    "customLabel": true,
                    "customSize": true,
                    "customSizeOptions": null
                },
                {
                    "id": 6,
                    "code": "amazon-st1",
                    "name": "st1",
                    "displayOrder": 3,
                    "defaultType": false,
                    "customLabel": true,
                    "customSize": true,
                    "customSizeOptions": null
                }
            ],
            "rootStorageTypes": [
                {
                    "id": 7,
                    "code": "amazon-sc1",
                    "name": "sc1",
                    "displayOrder": 4,
                    "defaultType": false,
                    "customLabel": true,
                    "customSize": true,
                    "customSizeOptions": null
                },
                {
                    "id": 4,
                    "code": "amazon-io1",
                    "name": "io1",
                    "displayOrder": 2,
                    "defaultType": false,
                    "customLabel": true,
                    "customSize": true,
                    "customSizeOptions": null
                },
                {
                    "id": 5,
                    "code": "amazon-gp2",
                    "name": "gp2",
                    "displayOrder": 1,
                    "defaultType": true,
                    "customLabel": true,
                    "customSize": true,
                    "customSizeOptions": null
                },
                {
                    "id": 6,
                    "code": "amazon-st1",
                    "name": "st1",
                    "displayOrder": 3,
                    "defaultType": false,
                    "customLabel": true,
                    "customSize": true,
                    "customSizeOptions": null
                }
            ],
            "controllerTypes": []
        }
    ]
}

HTTP Request

GET https://api.gomorpheus.com/api/provision-types

Get Specific Provision Type

curl "https://api.gomorpheus.com/api/provision-types/9"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this

{
  "success": true,
  "provisionType": {
        "id": 9,
        "name": "Amazon",
        "description": null,
        "code": "amazon",
        "aclEnabled": false,
        "multiTenant": false,
        "managed": true,
        "hostNetwork": true,
        "customSupported": false,
        "mapPorts": false,
        "exportServer": null,
        "viewSet": "amazonCustom",
        "serverType": "ami",
        "hostType": "vm",
        "addVolumes": true,
        "hasDatastore": false,
        "hasNetworks": null,
        "maxNetworks": null,
        "customizeVolume": true,
        "rootDiskCustomizable": true,
        "lvmSupported": true,
        "hostDiskMode": "lvm",
        "minDisk": 0,
        "maxDisk": null,
        "resizeCopiesVolumes": true,
        "optionTypes": [
            {
                "name": "subnet",
                "description": null,
                "fieldName": "subnetId",
                "fieldLabel": "Subnet",
                "fieldContext": "config",
                "fieldAddOn": null,
                "placeHolder": null,
                "helpBlock": "",
                "defaultValue": null,
                "optionSource": "amazonSubnet",
                "type": "select",
                "advanced": false,
                "required": true,
                "editable": false,
                "config": [],
                "displayOrder": 100
            },
            {
                "name": "security group",
                "description": null,
                "fieldName": "securityId",
                "fieldLabel": "Security Group",
                "fieldContext": "config",
                "fieldAddOn": null,
                "placeHolder": null,
                "helpBlock": "",
                "defaultValue": null,
                "optionSource": "amazonSecurityGroup",
                "type": "select",
                "advanced": false,
                "required": true,
                "editable": false,
                "config": [],
                "displayOrder": 101
            },
            {
                "name": "public key",
                "description": null,
                "fieldName": "publicKeyId",
                "fieldLabel": "Public Key",
                "fieldContext": "config",
                "fieldAddOn": null,
                "placeHolder": null,
                "helpBlock": "",
                "defaultValue": null,
                "optionSource": "keyPairs",
                "type": "select",
                "advanced": false,
                "required": false,
                "editable": false,
                "config": [],
                "displayOrder": 9
            }
        ],
        "customOptionTypes": [],
        "networkTypes": [],
        "storageTypes": [
            {
                "id": 7,
                "code": "amazon-sc1",
                "name": "sc1",
                "displayOrder": 4,
                "defaultType": false,
                "customLabel": true,
                "customSize": true,
                "customSizeOptions": null
            },
            {
                "id": 4,
                "code": "amazon-io1",
                "name": "io1",
                "displayOrder": 2,
                "defaultType": false,
                "customLabel": true,
                "customSize": true,
                "customSizeOptions": null
            },
            {
                "id": 5,
                "code": "amazon-gp2",
                "name": "gp2",
                "displayOrder": 1,
                "defaultType": true,
                "customLabel": true,
                "customSize": true,
                "customSizeOptions": null
            },
            {
                "id": 6,
                "code": "amazon-st1",
                "name": "st1",
                "displayOrder": 3,
                "defaultType": false,
                "customLabel": true,
                "customSize": true,
                "customSizeOptions": null
            }
        ],
        "rootStorageTypes": [
            {
                "id": 7,
                "code": "amazon-sc1",
                "name": "sc1",
                "displayOrder": 4,
                "defaultType": false,
                "customLabel": true,
                "customSize": true,
                "customSizeOptions": null
            },
            {
                "id": 4,
                "code": "amazon-io1",
                "name": "io1",
                "displayOrder": 2,
                "defaultType": false,
                "customLabel": true,
                "customSize": true,
                "customSizeOptions": null
            },
            {
                "id": 5,
                "code": "amazon-gp2",
                "name": "gp2",
                "displayOrder": 1,
                "defaultType": true,
                "customLabel": true,
                "customSize": true,
                "customSizeOptions": null
            },
            {
                "id": 6,
                "code": "amazon-st1",
                "name": "st1",
                "displayOrder": 3,
                "defaultType": false,
                "customLabel": true,
                "customSize": true,
                "customSizeOptions": null
            }
        ],
        "controllerTypes": []
    }
}

HTTP Request

GET https://api.gomorpheus.com/api/provision-types/:id

Option Types

Morpheus has several objects that have dynamic models depending on the type of the object. This includes options when provisioning different instances or even options when defining tasks or creating docker hosts!. This section aims to describe what is contained in the option-types association as well as how to query morpheus for available options in certain option-type scenarios.

Example of an Option Type Record

{
    "optionTypes": [
                {
                    "name": "subnet",
                    "description": null,
                    "fieldName": "subnetId",
                    "fieldLabel": "Subnet",
                    "fieldContext": "config",
                    "fieldAddOn": null,
                    "placeHolder": null,
                    "helpBlock": "",
                    "defaultValue": null,
                    "optionSource": "amazonSubnet",
                    "type": "select",
                    "advanced": false,
                    "required": true,
                    "editable": false,
                    "config": [],
                    "displayOrder": 100
                },
                {
                    "name": "security group",
                    "description": null,
                    "fieldName": "securityId",
                    "fieldLabel": "Security Group",
                    "fieldContext": "config",
                    "fieldAddOn": null,
                    "placeHolder": null,
                    "helpBlock": "",
                    "defaultValue": null,
                    "optionSource": "amazonSecurityGroup",
                    "type": "select",
                    "advanced": false,
                    "required": true,
                    "editable": false,
                    "config": [],
                    "displayOrder": 101
                },
                {
                    "name": "public key",
                    "description": null,
                    "fieldName": "publicKeyId",
                    "fieldLabel": "Public Key",
                    "fieldContext": "config",
                    "fieldAddOn": null,
                    "placeHolder": null,
                    "helpBlock": "",
                    "defaultValue": null,
                    "optionSource": "keyPairs",
                    "type": "select",
                    "advanced": false,
                    "required": false,
                    "editable": false,
                    "config": [],
                    "displayOrder": 9
                }
            ]
}

Option types can easily represent some common input types, including text, number, radio, checkbox, and dropdown/multiple choice.

JSON Parameters

Parameter Description
name The name of the option type for handy reference
description Short description of hte option type (the CLI actually shows this when pressing ? for help)
fieldName The property key for when posting this option type to a JSON POST request
fieldLabel User friendly label for prompting a user for input
fieldContext Some properties need nested i.e. in a config: {} block. This is a . seperated context of where the property should be constructed
placeHolder Any placeholder text when nothing is yet entered
helpBlock Short help text describing the option
defaultValue The default value if no user entry is specified. This value should be passed to the desired JSON Map if nothing else is entered
optionSource Option source references an API endpoint for receiving a JSON list of available options for this field.
type The type of input. I.e. text, select, radio,checkbox, etc.
required Is this field entry required for the request
editable Used primarily on tasks and workflows. Basically wether or not the field can be overridden optionally when the object is run
displayOrder The order with which the fields should be prompted. This is rather important when using optionSource in some scenarios for determining available values.
config: Any special configuration options pertaining to specific input types, like a radio button.

Get Option Source Data

curl "https://api.gomorpheus.com/api/options/keyPairs"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this

[
    ["name": "Davids Key Pair", "value": 1]
]

HTTP Request

GET https://api.gomorpheus.com/api/options/:optionSource

Returns a list of name/value pairs for option-type models. Some option-types depend on input data for proper representation. This typically includes zoneId or siteId for the item being provisioned as request parameters or sometimes previous option type parameters.

Deployment Management

Provides API’s used for creating “Deployment archives” for use with deployable instance types (i.e. Tomcat, Nginx, Apache, etc.). These endpoints also provide a means to trigger a deploy as well as to rollback from a failed deploy. There is a flow to creating a deployment archive. First you must create an appDeploy record. Then you can freely upload files to that deployment archive. Once your upload is complete it is easy to simply trigger the deploy.

Get all Deployments

curl "https://api.gomorpheus.com/api/instances/1/deploy"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "appDeploys": [
    {
      "config": null,
      "dateCreated": "2015-11-14T23:49:24Z",
      "deployDate": "2015-11-14T23:49:47Z",
      "deployGroup": null,
      "deployType": "browser",
      "fetchUrl": null,
      "gitRef": null,
      "gitUrl": null,
      "id": 2,
      "instanceId": 5,
      "keyPair": {
        "id": 1,
        "name": null
      },
      "lastUpdated": "2015-11-14T23:49:47Z",
      "status": "committed",
      "userVersion": null
    }
  ],
  "success": true
}

This endpoint retrieves all deploys that were created for a given instance

HTTP Request

GET https://api.gomorpheus.com/api/instances/1/deploy

Create a new Deployment

curl -XPOST "https://api.gomorpheus.com/api/instances/1/deploy"
  -H "Authorization: BEARER access_token"
  -H "Content-Type: application/json" \
  -d '{"appDeploy":{
    "deployType": 'browser',
    "gitUrl": null,
    "fetchUrl": null,
    "gitRef": null,
    "userVersion": "1.0.0"
  }}'

The above command returns JSON structured like this:

{
  "appDeploy": {
    "deployType": 'browser',
    "gitUrl": null,
    "fetchUrl": null,
    "gitRef": null,
    "userVersion": "1.0.0",
    "status": "open",
    "dateCreated": null,
    "lastUpdated": null,
    "config": null,
    "deployGroup": null,
    "userVersion": "1.0.0"
  }
}

This endpoint will create a new AppDeploy entry configured for the specific instance in the url. Depending on the deployment type you may want to upload files to the archive.

HTTP Request

POST https://api.gomorpheus.com/api/instances/:id/deploy

JSON Check Parameters

Parameter Default Description
userVersion null Optional version tag for reference of teh build
deployType browser The type of deployment. File based is browser, git for git and fetch for fetching from a url
gitUrl null The ssh git url to use to fetch files for the archive
gitRef null The branch or tag name to be used to fetch from on git.
fetchUrl null Used for fetch deploy type. Can fetch a zip file or general file and extract into archive
deployGroup null Not yet in use but used to organize deploys for multiple apps in the same group
config null JSON encoded list of parameters that varies by instance type. See below for more information

Upload Files to Deployment Archive

Monitor Checks

These entities define what and when a check is executed within the Morpheus system. Morpheus supports a vast array of different check types (not solely web checks). The API provides a means to list all of an account’s checks in addition to create, modify, mute, and or delete them.

Get All Checks

curl "https://api.gomorpheus.com/api/checks"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "checks": [
    {
      "id": 798,
      "account": {
        "id": 1
      },
      "active": true,
      "availability": 99.9804109,
      "checkAgent": null,
      "checkIntegrations": [

      ],
      "checkInterval": 300,
      "checkSpec": null,
      "checkType": {
        "id": 1
      },
      "config": "{\n  \"webMethod\" : \"GET\",\n  \"webUrl\" : \"http:\\\/\\\/google.com\"\n}",
      "createIncident": true,
      "dateCreated": "2015-05-16T12:05:23Z",
      "deleted": false,
      "description": null,
      "health": 10,
      "history": "{\"checkDates\":[1433339580607,1433339595119,1433339613169,1433339625412,1433339641010,1433339655209,1433339670178,1433339687802,1433339700471,1433339715171,1433339730710,1433339745351,1433339764299,1433339775508,1433339790377,1433339805373,1433339820944,1433339835996,1433339850317,1433339865833,1433339880884,1433339895489,1433339910554,1433339925660,1433339940875,1433339956143,1433339970551,1433339985179,1433340000961,1433340015765],\"successList\":[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true],\"healthList\":[10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10],\"timerList\":[347,410,338,337,365,361,373,374,358,337,350,505,342,338,358,359,381,354,353,377,342,344,349,363,329,352,350,348,356,345]}",
      "inUptime": true,
      "lastBoxStats": null,
      "lastCheckStatus": "success",
      "lastError": "http error: Read timed out",
      "lastErrorDate": "2015-05-18T09:25:15Z",
      "lastMessage": "http 200",
      "lastMetric": "200",
      "lastRunDate": "2015-06-03T14:00:16Z",
      "lastStats": null,
      "lastSuccessDate": "2015-06-03T14:00:16Z",
      "lastTimer": 345,
      "lastUpdated": "2015-06-03T14:00:16Z",
      "lastWarningDate": null,
      "name": "Purity Plus",
      "nextRunDate": "2015-06-03T14:00:16Z",
      "severity": "critical",
      "startDate": null
    }
  ]
}

This endpoint retrieves all checks and their JSON encoded configuration attributes based on check type. Check data is encrypted in the database.

HTTP Request

GET https://api.gomorpheus.com/api/checks

Query Parameters

Parameter Default Description
max 25 Max number of results to return
offset 0 Offset of records you want to load
lastUpdated null Date filter, restricts query to only load checks updated timestamp is more recent or equal to the date specified
deleted undefined Used to specify you can load previously deleted checks. Useful for synchronizing deleted records in your client side store.

Get a Specific Check

curl "https://api.gomorpheus.com/api/checks/1" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "success": true,
  "check:" {
    "id": 798,
    "account": {
      "id": 1
    },
    "active": true,
    "availability": 99.9804109,
    "checkAgent": null,
    "checkIntegrations": [

    ],
    "checkInterval": 300,
    "checkSpec": null,
    "checkType": {
      "id": 1
    },
    "config": "{\n  \"webMethod\" : \"GET\",\n  \"webUrl\" : \"http:\\\/\\\/google.com\"\n}",
    "createIncident": true,
    "dateCreated": "2015-05-16T12:05:23Z",
    "deleted": false,
    "description": null,
    "health": 10,
    "history": "{\"checkDates\":[1433339580607,1433339595119,1433339613169,1433339625412,1433339641010,1433339655209,1433339670178,1433339687802,1433339700471,1433339715171,1433339730710,1433339745351,1433339764299,1433339775508,1433339790377,1433339805373,1433339820944,1433339835996,1433339850317,1433339865833,1433339880884,1433339895489,1433339910554,1433339925660,1433339940875,1433339956143,1433339970551,1433339985179,1433340000961,1433340015765],\"successList\":[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true],\"healthList\":[10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10],\"timerList\":[347,410,338,337,365,361,373,374,358,337,350,505,342,338,358,359,381,354,353,377,342,344,349,363,329,352,350,348,356,345]}",
    "inUptime": true,
    "lastBoxStats": null,
    "lastCheckStatus": "success",
    "lastError": "http error: Read timed out",
    "lastErrorDate": "2015-05-18T09:25:15Z",
    "lastMessage": "http 200",
    "lastMetric": "200",
    "lastRunDate": "2015-06-03T14:00:16Z",
    "lastStats": null,
    "lastSuccessDate": "2015-06-03T14:00:16Z",
    "lastTimer": 345,
    "lastUpdated": "2015-06-03T14:00:16Z",
    "lastWarningDate": null,
    "name": "Purity Plus",
    "nextRunDate": "2015-06-03T14:00:16Z",
    "severity": "critical",
  }
}

This endpoint retrieves a specific check.

HTTP Request

GET https://api.gomorpheus.com/api/checks/:id

URL Parameters

Parameter Description
ID ID of the check to retrieve

Create a Check

curl -XPOST "https://api.gomorpheus.com/api/checks" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"check":{
    "name": "My Check",
    "checkType": {"code": "webGetCheck"},
    "inUptime": true,
    "severity": "critical",
    "description": null,
    "checkInterval": 300,
    "checkAgent": null,
    "active": true,
    "config": "{\n  \"webMethod\" : \"GET\",\n  \"webUrl\" : \"http:\\\/\\\/google.com\"\n}",
  }}'

The above command returns a similar JSON structure when submitting a GET request for a single check

HTTP Request

POST https://api.gomorpheus.com/api/checks

JSON Check Parameters

Parameter Default Description
name null Unique name scoped to your account for the check
description null Optional description field
checkType null Check type you want to create, use code and a valid check type: {"code": "webGetCheck"}
checkInterval 300 Number of seconds you want between check executions (minimum value is 60, depending on your subscription plan)
inUptime true Used to determine if check should affect account wide availability calculations
active true Used to determine if check should be scheduled to execute
severity critical Severity level of incidents that are created when this check fails. They can be info, warning, or critical
checkAgent null Specifies agent you want to run the check with i.e. {"id": 1} See Agents for more information
config null JSON encoded list of parameters that varies by check type. See below for more information

Updating a Check

curl -XPUT "https://api.gomorpheus.com/api/checks/1" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"check":{
    "name": "My Check",
    "checkType": {"code": "webGetCheck"},
    "inUptime": true,
    "severity": "critical",
    "description": null,
    "checkInterval": 300,
    "checkAgent": null,
    "active": true,
    "config": "{\n  \"webMethod\" : \"GET\",\n  \"webUrl\" : \"http:\\\/\\\/google.com\"\n}",
  }}'

The above command returns a similar JSON structure when submitting a GET request for a single check

HTTP Request

PUT https://api.gomorpheus.com/api/checks/:id

JSON Check Parameters

Parameter Default Description
name null Unique name scoped to your account for the check
description null Optional description field
checkType null Check type you want to create, use code and a valid check type: {"code": "webGetCheck"}
checkInterval 300 Number of seconds you want between check executions (minimum value is 60, depending on your subscription plan)
inUptime true Used to determine if check should affect account wide availability calculations
active true Used to determine if check should be scheduled to execute
severity critical Severity level of incidents that are created when this check fails. They can be info, warning, or critical
checkAgent null Specifies agent you want to run the check with i.e. {"id": 1} See Agents for more information
config null JSON encoded list of parameters that varies by check type. See below for more information

Check Types and Options

We support a wide variety of check types. Each check type varies in its configuration payload when determining how the check should be run.

Creates a Web type Check

Web Get Check

{
  "check": {
    "name": "My Web Check",
    "checkType": {"code": "webGetCheck"},
    "config": "{\"webMethod\":\"GET\",\"webUrl\": \"http:\\\/\\\/google.com\", \"checkUser\":\"basicUser\",\"checkPassword\":\"basicPassword\", \"webTextMatch\": \"Login\", \"textCheckOn\": \"on\"}"
  }
}

Code: webGetCheck

Web check type allows you to perform a standard web request and validate the response came back successfully. Additionally, you can check for matching text within the result. There are several config parameters available for use with this type of check

Parameter Requirement Description
webMethod Yes HTTP method to use for testing (GET or POST)
webUrl Yes Web URL you wish to use to run a check on
checkUser No If you want to use HTTP Basic Authentication, populate this field with the username
checkPassword No If you want to use HTTP basic Authentication, populate this field with the password
textCheckOn No Set value to “on” if you want to turn on text matching
webTextMatch No Set the string you want to look for in the page source

MySQL Check

{
  "check": {
    "name": "MySql Check",
    "checkType": {"code": "mysqlCheck"},
    "config": "{\"dbHost\":\"db.example.org\",\"dbPort\": \"3306\", \"dbUser\":\"basicUser\",\"dbPassword\":\"basicPassword\", \"dbName\": \"mydb\", \"dbQuery\": \"select 1\", \"checkOperator\": \"lt\", \"checkResult\": 2}"
  }
}

Code: mysqlCheck

MySQL check allows you to execute a query so that you may validate the value returned in addition to verifying the database is responding. This can be useful for doing a slow query check or just making sure something isn’t growing out of control.

Parameter Requirement Description
dbHost Yes Hostname or IP address of the MySQL database
dbPort Yes MySQL Port (defaults to 3306)
dbUser Yes Database username
dbPassword Yes Database password, (all check data is encrypted inside the Morpheus database)
dbName Yes Database name you would like to connect to
checkOperator No Can be set to lt (less than), gt (greater than), equal (Equal to) for comparison
checkResult No Numerical value to compare the check result against

SQL Server Check

{
  "check": {
    "name": "SQL Server Check",
    "checkType": {"code": "sqlCheck"},
    "config": "{\"dbHost\":\"db.example.org\",\"dbPort\": \"3306\", \"dbUser\":\"basicUser\",\"dbPassword\":\"basicPassword\", \"dbName\": \"mydb\", \"dbQuery\": \"select 1\", \"checkOperator\": \"lt\", \"checkResult\": 2}"
  }
}

Code: sqlCheck

SQL Server check allows to execute a query so that you may validate the value returned in addition to verifying the database is responding. This can be useful for doing a slow query check or just making sure something isn’t growing out of control.

Parameter Requirement Description
dbHost Yes Hostname or IP address of the SQL database
dbPort Yes SQL Port (defaults to 1433)
dbUser Yes Database username
dbPassword Yes Database password, (all check data is encrypted inside the Morpheus database)
dbName Yes Database name you would like to connect to
checkOperator No Can be set to lt (less than), gt (greater than), equal (Equal to) for comparison
checkResult No Numerical value to compare the check result against

PostgreSQL Check

{
  "check": {
    "name": "PostgerSQL Check",
    "checkType": {"code": "postgresCheck"},
    "config": "{\"dbHost\":\"db.example.org\",\"dbPort\": \"3306\", \"dbUser\":\"basicUser\",\"dbPassword\":\"basicPassword\", \"dbName\": \"mydb\", \"dbQuery\": \"select 1\", \"checkOperator\": \"lt\", \"checkResult\": 2}"
  }
}

Code: postgresCheck

PostgreSQL check allows to execute a query so that you may validate the value returned in addition to verifying the database is responding. This can be useful for doing a slow query check or just making sure something isn’t growing out of control.

Parameter Requirement Description
dbHost Yes Hostname or IP address of the PostgreSQL database
dbPort Yes SQL Port (defaults to 5432)
dbUser Yes Database username
dbPassword Yes Database password, (all check data is encrypted inside the Morpheus database)
dbName Yes Database name you would like to connect to
checkOperator No Can be set to lt (less than), gt (greater than), equal (Equal to) for comparison
checkResult No Numerical value to compare the check result against

Socket Check

{
  "check": {
    "name": "Socket Check",
    "checkType": {"code": "socketCheck"},
    "config": "{\"host\":\"test.example.org\",\"port\": \"3306\", \"send\":\"blah\",\"responseMatch\":\"OK\"}"
  }
}

Code: socketCheck

Socket check confirms a certain TCP port is up and responding in your environment. It can be configured do an initial send upon connect and compare and expected response of the service.

Parameter Requirement Description
host Yes Hostname or IP address of the socket server
port Yes TCP port
send No Connection string you might want to send to the service
responseMatch No Response from the service to match against

Elastic Search Check

{
  "check": {
    "name": "Socket Check",
    "checkType": {"code": "elasticSearchCheck"},
    "config": "{\"esHost\":\"test.example.org\",\"esPort\": \"9200\"}"
  }
}

Code: elasticSearchCheck

Elasticsearch check is capable of connecting to your Elasticsearch, cluster or node, verifying its health. In addition, Morpheus will also pull statistical information such as: document size, capacity, and cpu usage.

Parameter Requirement Description
esHost Yes Hostname or IP address of the Elasticsearch server
esPort Yes Port to connect to the HTTP service

Push Check

{
  "check": {
    "name": "Push Check",
    "checkType": {"code": "pushCheck"}
  }
}

Code: pushCheck

A Push check is a check that is updated by a web hook. An external source is responsible for periodically submitting a check status. Please see the section on Push Checks API for details.

SSH Tunneling

SSH tunneling options allow the different check types to tunnel to a host via a proxy, and execute checks relative to the proxy. A SSH tunnel can use your account generated public and private key-pairs or SSH password (we strongly recommend using a key-pair).

To enable SSH tunneling for a check, add the following parameters to any check type config as seen earlier in the Check Types section.

{
  "check": {
    "name": "Socket Check",
    "checkType": {"code": "elasticSearchCheck"},
    "config": "{\"esHost\":\"test.example.org\",\"esPort\": \"9200\", \"tunnelOn\": \"on\", \"sshHost\": \"example.org\", \"sshPort\": 22, \"sshUser\": \"happyapps\"}"
  }
}
Parameter Requirement Description
tunnelOn Yes Set to on to turn on tunneling
sshHost Yes Hostname or IP address of the proxy host
sshPort No Port for SSH on the proxy host, defaults to 22
sshUser Yes SSH user on the proxy host to login as
sshPassword No Password for user, if not using key based authentication

Mute a Check

curl -XPUT "https://api.gomorpheus.com/api/checks/1/mute" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true}'

The above command returns JSON structure like this:

{
  "muteState": "QUARANTINED",
  "success": true
}

This endpoint can be used to toggle the mute state of a check on and off.

HTTP Request

PUT https://api.gomorpheus.com/api/checks/:id/mute

JSON Parameters

Parameter Description
enabled Set to true or false

Delete a Check

curl -XDELETE "https://api.gomorpheus.com/api/checks/1" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true
}

A deleted check can be fetched from the API using the GET method to synchronize client side views, but can not be executed or updated.

Check Types

A set of APIs for fetching a list of available check types is also provided. This API can make it useful for associating a check type code to an ID for check GET and POST requests.

Get All Check Types

curl "https://api.gomorpheus.com/api/check-types"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this

{
  "checkTypes": [
    {
      "id": 1,
      "code": "webGetCheck",
      "createIncident": true,
      "defaultInterval": 60000,
      "iconPath": null,
      "iconType": "upload",
      "inUptime": true,
      "metricName": "response",
      "name": "Web Check",
      "tunnelSupported": true
    },
    {
      "id": 2,
      "code": "mysqlCheck",
      "createIncident": true,
      "defaultInterval": 60000,
      "iconPath": null,
      "iconType": "upload",
      "inUptime": true,
      "metricName": "result",
      "name": "MySQL Check",
      "tunnelSupported": true
    },
    {
      "id": 3,
      "code": "mongoCheck",
      "createIncident": true,
      "defaultInterval": 300000,
      "iconPath": null,
      "iconType": "upload",
      "inUptime": true,
      "metricName": "result",
      "name": "Mongo Check",
      "tunnelSupported": true
    },
    {
      "id": 4,
      "code": "elasticSearchCheck",
      "createIncident": true,
      "defaultInterval": 60000,
      "iconPath": null,
      "iconType": "upload",
      "inUptime": true,
      "metricName": "cluster status",
      "name": "Elastic Search Check",
      "tunnelSupported": true
    },
    {
      "id": 5,
      "code": "riakCheck",
      "createIncident": true,
      "defaultInterval": 300000,
      "iconPath": null,
      "iconType": "upload",
      "inUptime": true,
      "metricName": "write time",
      "name": "Riak Check",
      "tunnelSupported": true
    },
    {
      "id": 6,
      "code": "redisCheck",
      "createIncident": true,
      "defaultInterval": 300000,
      "iconPath": null,
      "iconType": "upload",
      "inUptime": true,
      "metricName": "key count",
      "name": "Redis Check",
      "tunnelSupported": true
    },
    {
      "id": 7,
      "code": "rabbitCheck",
      "createIncident": true,
      "defaultInterval": 60000,
      "iconPath": null,
      "iconType": "upload",
      "inUptime": true,
      "metricName": "queue count",
      "name": "Rabbit MQ Check",
      "tunnelSupported": true
    },
    {
      "id": 9,
      "code": "postgresCheck",
      "createIncident": true,
      "defaultInterval": 300000,
      "iconPath": null,
      "iconType": "upload",
      "inUptime": true,
      "metricName": "result",
      "name": "Postgres Check",
      "tunnelSupported": true
    },
    {
      "id": 10,
      "code": "sqlCheck",
      "createIncident": true,
      "defaultInterval": 300000,
      "iconPath": null,
      "iconType": "upload",
      "inUptime": true,
      "metricName": "result",
      "name": "Microsoft SQL Server",
      "tunnelSupported": true
    },
    {
      "id": 11,
      "code": "socketCheck",
      "createIncident": true,
      "defaultInterval": 60000,
      "iconPath": null,
      "iconType": "upload",
      "inUptime": true,
      "metricName": "response",
      "name": "Socket Check",
      "tunnelSupported": true
    },
    {
      "id": 12,
      "code": "pushCheck",
      "createIncident": true,
      "defaultInterval": 300000,
      "iconPath": null,
      "iconType": "upload",
      "inUptime": true,
      "metricName": "result",
      "name": "Push API Check",
      "tunnelSupported": false
    },
    {
      "id": 13,
      "code": "pingCheck",
      "createIncident": true,
      "defaultInterval": 300000,
      "iconPath": null,
      "iconType": "upload",
      "inUptime": true,
      "metricName": "result",
      "name": "Ping Check",
      "tunnelSupported": true
    }
  ]
}

HTTP Request

GET https://api.gomorpheus.com/api/check-types

Get Specific Check Type

curl "https://api.gomorpheus.com/api/check-types/10"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this

{
  "success": true,
  "checkType": {
    "id": 10,
    "code": "sqlCheck",
    "createIncident": true,
    "defaultInterval": 300000,
    "iconPath": null,
    "iconType": "upload",
    "inUptime": true,
    "metricName": "result",
    "name": "Microsoft SQL Server",
    "tunnelSupported": true
  }
}

HTTP Request

GET https://api.gomorpheus.com/api/check-types/1

Server Groups

Server Groups are used to organize provisioned servers in your infrastructure. When a user on the system provisions an instance like MySQL, they can select which group to provision the instance into. This can be used to scope servers by environment or by region.

Get All Groups

curl "https://api.gomorpheus.com/api/groups"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "groups": [
    {
      "id": 1,
      "accountId": 1,
      "name": "Amazon East",
      "code": "amazon",
      "active": true,
      "location": null,
      "visibility": "public",
      "zones": [
        {
          "id": 1,
          "accountId": 1,
          "groupId": 1,
          "name": "VPC 1a",
          "description": "1a VPC Subnet",
          "location": null,
          "visibility": "public",
          "zoneTypeId": 1
        }
      ]
    }
  ]
}

This endpoint retrieves all groups and a list of zones associated with the group by id.

HTTP Request

GET https://api.gomorpheus.com/api/groups

Query Parameters

Parameter Default Description
lastUpdated null A date filter, restricts query to only load groups updated more recent or equal to the date specified
name null If specified will return an exact match group

Get a Specific Group

curl "https://api.gomorpheus.com/api/groups/1" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "success": true,
  "group": {
    "id": 1,
    "accountId": 1,
    "name": "Vagrant",
    "code": null,
    "active": true,
    "location": null,
    "visibility": "public",
    "zones": [
      {
        "id": 1,
        "accountId": 1,
        "groupId": 1,
        "name": "Davids Laptop",
        "description": "My Laptop Vagrant",
        "location": null,
        "visibility": "public",
        "zoneTypeId": 1
      }
    ]
  }
}

This endpoint retrieves a specific group.

HTTP Request

GET https://api.gomorpheus.com/api/groups/:id

URL Parameters

Parameter Description
ID The ID of the group to retrieve

Create a Group

curl -XPOST "https://api.gomorpheus.com/api/groups" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"group":{
    "name": "My Group",
    "description": "My description",
    "location": "US EAST"
  }}'

The above command returns JSON structured like getting a single group:

HTTP Request

POST https://api.gomorpheus.com/api/groups

JSON Check Parameters

Parameter Default Description
name null A unique name scoped to your account for the group
description null Optional description field if you want to put more info there
code null Optional code for use with policies
location null Optional location argument for your group

Updating a Group

curl -XPUT "https://api.gomorpheus.com/api/groups/1" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"group":{
    "name": "My Group",
    "description": "My description",
    "location": "US EAST"
  }}'

The above command returns JSON structured like getting a single group:

HTTP Request

PUT https://api.gomorpheus.com/api/groups/:id

JSON Check Parameters

Parameter Default Description
name null A unique name scoped to your account for the group
description null Optional description field if you want to put more info there
code null Optional code for use with policies
location null Optional location for your group

Updating Group Zones

curl -XPUT "https://api.gomorpheus.com/api/groups/1/update-zones" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"group":{
    "zones": [
      {"id": 1}, {"id": 2}, {"id": 5}
    ]
  }}'

The above command returns JSON Structured like this:

{
  "success": true
}

This will update the zones that are assigned to the group. Any zones that are not passed in the zones parameter will be removed from the group.

HTTP Request

PUT https://api.gomorpheus.com/api/groups/:id/update-zones

JSON Check Parameters

Parameter Default Description
zones null An array of all the zones assigned to this group.

Delete a Group

curl -XDELETE "https://api.gomorpheus.com/api/groups/1" \
  -H "Authorization: BEARER access_token"

The above command returns JSON Structured like this:

{
  "success": true
}

If a group has zones or servers still tied to it, a delete action will fail

Compute Zones

Zones are a means of zoning various servers based on provisioning type or subnets. Typically a Zone belongs to a zone and a zone can have many zones. There are several supported zone types that can be used for hardware/vm procurement such as the OpenStack zone type. The zone holds the credentials necessary to provision virtual machines on the open stack api. Amazon is another openstack zone type currently in the works. Of course, we also have the Standard zone type which allows for manual vm procurement.

Get All Zones

curl "https://api.gomorpheus.com/api/zones"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "zones": [
    {
      "id": 1,
      "accountId": 1,
      "groupId": 1,
      "name": "Davids Laptop",
      "description": "My Laptop Vagrant",
      "location": null,
      "visibility": "public",
      "zoneTypeId": 1
    }
  ]
}

This endpoint retrieves all zones and a list of zones associated with the zone by id.

HTTP Request

GET https://api.gomorpheus.com/api/zones

Query Parameters

Parameter Default Description
lastUpdated null A date filter, restricts query to only load zones updated more recent or equal to the date specified
name null If specified will return an exact match zone
type null If specified will return all zones by type code (standard,openstack,amazon)
groupId null If specified will return all zones assigned to a server group by id.

Get a Specific Zone

curl "https://api.gomorpheus.com/api/zones/1" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "success": true,
  "zone": {
    "id": 1,
    "accountId": 1,
    "groupId": 1,
    "name": "Davids Laptop",
    "description": "My Laptop Vagrant",
    "location": null,
    "visibility": "public",
    "zoneTypeId": 1
  }
}

This endpoint retrieves a specific zone.

HTTP Request

GET https://api.gomorpheus.com/api/zones/:id

URL Parameters

Parameter Description
ID The ID of the zone to retrieve

Create a Zone

curl -XPOST "https://api.gomorpheus.com/api/zones" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"zone":{
    "name": "My Zone",
    "code": "myzone",
    "description": "My description",
    "location": "US EAST",
    "zoneType": {"code": "standard"},
    "groupId": 1
  }}'

The above command returns JSON structured like getting a single zone:

HTTP Request

POST https://api.gomorpheus.com/api/zones

JSON Check Parameters

Parameter Default Description
name null A unique name scoped to your account for the zone
description null Optional description field if you want to put more info there
code null Optional code for use with policies
location null Optional location for your zone
visibility private private or public
zoneType “standard” Map containing code or id of the zone type
groupId null Specifies which Server group this zone should be assigned to

Additional properties are dynamic for the most part depending on teh zone/cloud type. To determine what these are please look at the optionTypes list on the ZoneType record.

Updating a Zone

curl -XPUT "https://api.gomorpheus.com/api/zones/1" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"zone":{
    "name": "My Zone",
    "description": "My description",
    "location": "US EAST",
    "zoneType": {"code": "standard"},
    "groupId": 1,
    "config": null
  }}'

The above command returns JSON structured like getting a single zone:

HTTP Request

PUT https://api.gomorpheus.com/api/zones/:id

JSON Check Parameters

Parameter Default Description
name null A unique name scoped to your account for the zone
description null Optional description field if you want to put more info there
code null Optional code for use with policies
location null Optional location for your zone
visibility private private or public
groupId null Specifies which Server group this zone should be assigned to
config null For non standard zone types, this is a json encoded string with config properties for openstack and Amazon. See the section on specific zone types for details.

Additional properties are dynamic for the most part depending on the zone/cloud type. To determine what these are please look at the optionTypes list on the ZoneType record.

Delete a Zone

curl -XDELETE "https://api.gomorpheus.com/api/zones/1" \
  -H "Authorization: BEARER access_token"

The above command returns JSON Structured like this:

{
  "success": true
}

If a zone has zones or servers still tied to it, a delete action will fail

Get Security Groups

curl -XGET "https://api.gomorpheus.com/api/zones/1/security-groups" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true,
  "firewallEnabled": true,
  "securityGroups": [
    {
      "id": 19,
      "accountId": 1,
      "name": "All Tomcat Access",
      "description": "Allow everyone to access Tomcat"
    }
  ]
}

This returns a list of all of the security groups applied to a zone and whether the firewall is enabled.

HTTP Request

GET https://api.gomorpheus.com/api/zones/:id/security-groups

Set Security Groups

curl -XPOST "https://api.gomorpheus.com/api/zones/1/security-groups" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{ "securityGroupIds": [19, 2] }'

The above command returns JSON structure similar to the ‘get’ of security groups.

HTTP Request

PUT https://api.gomorpheus.com/api/zones/:id/security-groups

JSON Parameters

Parameter Default Description
securityGroupIds null List of all security groups ids which should be applied. If no security groups should apply, pass ’[]’

Disable the firewall

curl -XPUT "https://api.gomorpheus.com/api/zones/1/security-groups/disable" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true
}

This will disable the firewall. Any configured security groups will not be applied.

HTTP Request

PUT https://api.gomorpheus.com/api/zones/:id/security-groups/disable

Enable the firewall

curl -XPUT "https://api.gomorpheus.com/api/zones/1/security-groups/enable" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true
}

This will enable the firewall. Any configured security groups will be applied.

HTTP Request

PUT https://api.gomorpheus.com/api/zones/:id/security-groups/enable

Zone Types

Provides a means to find out which zone types are available for zone provisioning and in the future what config properties are required. NOTE: A Zone Type in the API Is equivalent to a Cloud Type within the morpheus UI. .

Get All Zone Types

curl "https://api.gomorpheus.com/api/zone-types"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this

{
  "zoneTypes": [
    {
      "id": 3,
      "name": "Amazon",
      "code": "amazon",
      "description": "amazon zone"
      serverTypes: [],
      optionTypes: []
    },
    {
      "id": 2,
      "name": "Openstack",
      "code": "openstack",
      "description": "openstac zone",
      serverTypes: [],
      optionTypes: []
    },
    {
      "id": 1,
      "name": "Standard",
      "code": "standard",
      "description": "Standard zone - manually managed servers or virtual machines"
      serverTypes: [],
      optionTypes: []
    }
  ]
}

HTTP Request

GET https://api.gomorpheus.com/api/zone-types

Get Specific Zone Type

curl "https://api.gomorpheus.com/api/zone-types/1"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this

{
  "success": true,
  "zoneType": {
    "id": 1,
    "name": "Standard",
    "code": "standard",
    "description": "Standard zone - manually managed servers or virtual machines"
    serverTypes: [],
    optionTypes: []
  }
}

HTTP Request

GET https://api.gomorpheus.com/api/zone-types/:id

Compute Servers

A Compute Server is either a bare metal machine or virtual machine that is provisioned into morpheus via Chef. These servers are setup as Docker Hosts and used to provision containers into. They also run the morphd agent which reports server statistics and logs back to the morpheus stack.

Get All Servers

curl "https://api.gomorpheus.com/api/servers"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "servers": [
    {
      "id": 1,
      "accountId": 1,
      "name": "dre-matrix-1",
      "visibility": "public",
      "description": "dre-matrix-1",
      "zoneId": 1,
      "siteId": 1,
      "sshHost": "10.100.54.2",
      "internalIp": "10.100.54.2",
      "externalIp": "10.100.54.2",
      "sshPort": 22,
      "volumeId": null,
      "platform": null,
      "platformVersion": null,
      "sshUsername": "vagrant",
      "sshPassword": "****",
      "osDevice": "\/dev\/sda",
      "dataDevice": "\/dev\/sdb",
      "apiKey": "a3914182-0f2f-4e9c-a6d2-63822747b9cd",
      "softwareRaid": false,
      "config": null,
      "capacityInfo": {
        "class": "com.morpheus.ComputeCapacityInfo",
        "id": 1,
        "maxCores": null,
        "maxMemory": 2099228672,
        "maxStorage": 42945478656,
        "server": {
          "class": "com.morpheus.ComputeServer",
          "id": 1
        },
        "usedMemory": 1073741824,
        "usedStorage": 3221225472
      },
      "dateCreated": "2015-06-09T12:43:51Z",
      "lastUpdated": "2015-06-09T12:47:42Z",
      "lastStats": "{\"cpuIdleTime\":131115400,\"cpuSystemTime\":76300,\"cpuTotalTime\":131297000,\"cpuUsage\":0.13391375541687012,\"cpuUserTime\":105300,\"freeMemory\":91340800,\"freeSwap\":0,\"ts\":\"2015-06-10T13:11:45+0000\",\"usedMemory\":2007887872,\"usedSwap\":0}",
      "status": "provisioned",
      "interfaces": [
        {
          "id": 1,
          "active": true,
          "dhcp": true,
          "ipAddress": "10.100.54.2",
          "ipSubnet": null,
          "ipv6Address": null,
          "ipv6Subnet": null,
          "name": "eth1",
          "network": null,
          "networkPosition": null,
          "primaryInterface": true,
          "publicIpAddress": null,
          "publicIpv6Address": null,
          "server": {
            "id": 1
          }
        }
      ],
      "zone": {
        "id": 1,
        "accountId": 1,
        "groupId": 1,
        "name": "Davids Laptop",
        "description": "My Laptop Vagrant",
        "location": null,
        "visibility": "public",
        "zoneTypeId": 1
      }
    },
    {
      "id": 2,
      "accountId": 1,
      "name": "dre-matrix-2",
      "visibility": "public",
      "description": "dre-matrix-2",
      "zoneId": 1,
      "siteId": 1,
      "sshHost": "10.100.54.3",
      "internalIp": "10.100.54.3",
      "externalIp": "10.100.54.3",
      "sshPort": 22,
      "volumeId": null,
      "platform": null,
      "platformVersion": null,
      "sshUsername": "vagrant",
      "sshPassword": "****",
      "osDevice": "\/dev\/sda",
      "dataDevice": "\/dev\/sdb",
      "apiKey": "c3c12af8-1db2-44b3-930d-87f914b14577",
      "softwareRaid": false,
      "config": null,
      "capacityInfo": {
        "id": 2,
        "maxCores": null,
        "maxMemory": 2099228672,
        "maxStorage": 42945478656,
        "server": {
          "id": 2
        },
        "usedMemory": 1073741824,
        "usedStorage": 3221225472
      },
      "dateCreated": "2015-06-09T14:07:57Z",
      "lastUpdated": "2015-06-09T14:17:51Z",
      "lastStats": "{\"cpuIdleTime\":130016650,\"cpuSystemTime\":1041990,\"cpuTotalTime\":131172760,\"cpuUsage\":0.1677870750427246,\"cpuUserTime\":114120,\"freeMemory\":215248896,\"freeSwap\":0,\"ts\":\"2015-06-10T13:18:33+0000\",\"usedMemory\":1883979776,\"usedSwap\":0}",
      "status": "provisioned",
      "interfaces": [
        {
          "id": 2,
          "active": true,
          "dhcp": true,
          "ipAddress": "10.100.54.3",
          "ipSubnet": null,
          "ipv6Address": null,
          "ipv6Subnet": null,
          "name": "eth1",
          "network": null,
          "networkPosition": null,
          "primaryInterface": true,
          "publicIpAddress": null,
          "publicIpv6Address": null,
          "server": {
            "id": 2
          }
        }
      ],
      "zone": {
        "id": 1,
        "accountId": 1,
        "groupId": 1,
        "name": "Davids Laptop",
        "description": "My Laptop Vagrant",
        "location": null,
        "visibility": "public",
        "zoneTypeId": 1
      }
    }
  ],
  "serverCount": 2,
  "stats": {
    "1": {
      "usedStorage": 48861184,
      "reservedStorage": 3221225472,
      "maxStorage": 42945478656,
      "usedMemory": 2007887872,
      "reservedMemory": 1073741824,
      "maxMemory": 2099228672
    },
    "2": {
      "usedStorage": 18976768,
      "reservedStorage": 3221225472,
      "maxStorage": 42945478656,
      "usedMemory": 1883979776,
      "reservedMemory": 1073741824,
      "maxMemory": 2099228672
    }
  }
}

This endpoint retrieves all servers and their JSON encoded configuration attributes based on check type. Server data is encrypted in the database.

HTTP Request

GET https://api.gomorpheus.com/api/servers

Query Parameters

Parameter Default Description
max 25 Max number of results to return
offset 0 Offset of records you want to load
lastUpdated null Date filter, restricts query to only load servers updated timestamp is more recent or equal to the date specified

Get a Specific Server

curl "https://api.gomorpheus.com/api/servers/1" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "success": true,
  "server": {
    "id": 1,
    "accountId": 1,
    "name": "dre-matrix-1",
    "visibility": "public",
    "description": "dre-matrix-1",
    "zoneId": 1,
    "siteId": 1,
    "sshHost": "10.100.54.2",
    "internalIp": "10.100.54.2",
    "externalIp": "10.100.54.2",
    "sshPort": 22,
    "volumeId": null,
    "platform": null,
    "platformVersion": null,
    "sshUsername": "vagrant",
    "sshPassword": "****",
    "osDevice": "\/dev\/sda",
    "dataDevice": "\/dev\/sdb",
    "apiKey": "a3914182-0f2f-4e9c-a6d2-63822747b9cd",
    "softwareRaid": false,
    "config": null,
    "capacityInfo": {
      "class": "com.morpheus.ComputeCapacityInfo",
      "id": 1,
      "maxCores": null,
      "maxMemory": 2099228672,
      "maxStorage": 42945478656,
      "server": {
        "class": "com.morpheus.ComputeServer",
        "id": 1
      },
      "usedMemory": 1073741824,
      "usedStorage": 3221225472
    },
    "dateCreated": "2015-06-09T12:43:51Z",
    "lastUpdated": "2015-06-09T12:47:42Z",
    "lastStats": "{\"cpuIdleTime\":131294520,\"cpuSystemTime\":76390,\"cpuTotalTime\":131476290,\"cpuUsage\":0.10046958923339844,\"cpuUserTime\":105380,\"freeMemory\":91181056,\"freeSwap\":0,\"ts\":\"2015-06-10T13:14:45+0000\",\"usedMemory\":2008047616,\"usedSwap\":0}",
    "status": "provisioned",
    "interfaces": [
      {
        "id": 1,
        "active": true,
        "dhcp": true,
        "ipAddress": "10.100.54.2",
        "ipSubnet": null,
        "ipv6Address": null,
        "ipv6Subnet": null,
        "name": "eth1",
        "network": null,
        "networkPosition": null,
        "primaryInterface": true,
        "publicIpAddress": null,
        "publicIpv6Address": null,
        "server": {
          "id": 1
        }
      }
    ],
    "zone": {
      "id": 1,
      "accountId": 1,
      "groupId": 1,
      "name": "Davids Laptop",
      "description": "My Laptop Vagrant",
      "location": null,
      "visibility": "public",
      "zoneTypeId": 1
    }
  }
}

This endpoint retrieves a specific server.

HTTP Request

GET https://api.gomorpheus.com/api/servers/:id

URL Parameters

Parameter Description
ID ID of the check to retrieve

Provision a Server

curl -XPOST "https://api.gomorpheus.com/api/servers" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{ "server": {
  "name": "dre-matrix-3",
  "description": "dre-matrix-3",
  "zone": {"id":1},
  "sshHost": "10.100.54.4",
  "sshUsername": "vagrant",
  "sshPassword": "vagrant",
  "dataDevice": "/dev/sdb"
  },
  "network": {
    "name": "eth1"
  }}'

The above command returns a similar JSON structure when submitting a GET request for a single check

HTTP Request

POST https://api.gomorpheus.com/api/servers

JSON Server Parameters

Parameter Default Description
name null Unique name scoped to your account for the server
description null Optional description field
zone null The zone id we want to assign the server to.
sshHost null reachable ip address for the server to remote in and provision the server
sshUsername null ssh username to use when provisioning
sshPassword null optional ssh password to use, if not specified the account public key can be used
dataDevice null the mount point for the lvm volume that needs to be created

Updating a Server

curl -XPUT "https://api.gomorpheus.com/api/servers/1" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{ "server": {
  "name": "dre-matrix-3",
  "description": "dre-matrix-3"
  }}'

The above command returns a similar JSON structure when submitting a GET request for a single check

HTTP Request

PUT https://api.gomorpheus.com/api/servers/:id

JSON Server Parameters

Parameter Default Description
name null Unique name scoped to your account for the server
description null Optional description field

Delete a Server

curl -XDELETE "https://api.gomorpheus.com/api/servers/1" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true
}

Will delete a server asynchronously and remove from the hosted chef system.

Resize a Server

curl -XPUT "https://api.gomorpheus.com/api/servers/1/resize" \
  -H "Authorization: BEARER access_token"
  -H "Content-Type: application/json" \
  -d '{
    "server": {
      "id": 82,
      "plan": {
        "id": 76
      }
    },
    "volumes": [
      {
        "id": 419,
        "rootVolume": true,
        "name": "root",
        "size": 10,
        "sizeId": null,
        "storageType": 1,
        "datastoreId": "auto"
      }
    ],
    "deleteOriginalVolumes": true
  }'

The above command returns JSON structure like this:

{
  "success": true
}

Will resize a server asynchronously.

HTTP Request

PUT https://api.gomorpheus.com/api/servers/:id/resize

JSON Server Parameters

Parameter Default Description
server.plan.id null The ID of the new plan (optional).
volumes null List of volumes with their new sizes.
deleteOriginalVolumes false Delete the original volumes after resizing. (Amazon only)

Compute Server Types

A Compute Server Type is the description of the technology (bare metal or virtual) being deployed onto.

Get All Servers

curl "https://api.gomorpheus.com/api/server-types"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "serverTypes":[
    {
      "id":19,
      "code":"softlayerVm",
      "name":"Softlayer Instance",
      "description":"",
      "platform":"linux",
      "nodeType":"morpheus-vm-node",
      "managed":true,
      "enabled":true,
      "vmHypervisor":false,
      "containerHypervisor":false,
      "displayOrder":0,
      "selectable":false,
      "controlPower":true,
      "controlSuspend":true,
      "hasAgent":true,
      "creatable":false,
      "optionTypes":[

      ]
    },
    {
      "id":23,
      "code":"amazonVm",
      "name":"Amazon Instance",
      "description":"",
      "platform":"linux",
      "nodeType":"morpheus-vm-node",
      "managed":true,
      "enabled":true,
      "vmHypervisor":false,
      "containerHypervisor":false,
      "displayOrder":0,
      "selectable":false,
      "controlPower":true,
      "controlSuspend":true,
      "hasAgent":true,
      "creatable":false,
      "optionTypes":[

      ]
    },
    {
      "id":31,
      "code":"vmwareVm",
      "name":"Vmware Instance",
      "description":"",
      "platform":"linux",
      "nodeType":"morpheus-vm-node",
      "managed":true,
      "enabled":true,
      "vmHypervisor":false,
      "containerHypervisor":false,
      "displayOrder":0,
      "selectable":false,
      "controlPower":true,
      "controlSuspend":true,
      "hasAgent":true,
      "creatable":false,
      "optionTypes":[

      ]
    },
    {
      "id":39,
      "code":"nutanixVm",
      "name":"Nutanix Instance",
      "description":"",
      "platform":"linux",
      "nodeType":"morpheus-vm-node",
      "managed":true,
      "enabled":true,
      "vmHypervisor":false,
      "containerHypervisor":false,
      "displayOrder":0,
      "selectable":false,
      "controlPower":true,
      "controlSuspend":true,
      "hasAgent":true,
      "creatable":false,
      "optionTypes":[

      ]
    },
    {
      "id":43,
      "code":"xenserverVm",
      "name":"Xen Instance",
      "description":"",
      "platform":"linux",
      "nodeType":"morpheus-vm-node",
      "managed":true,
      "enabled":true,
      "vmHypervisor":false,
      "containerHypervisor":false,
      "displayOrder":0,
      "selectable":false,
      "controlPower":true,
      "controlSuspend":true,
      "hasAgent":true,
      "creatable":false,
      "optionTypes":[

      ]
    },
    {
      "id":14,
      "code":"metapodLinux",
      "name":"Metapod Linux Node",
      "description":"",
      "platform":"linux",
      "nodeType":"morpheus-node",
      "managed":true,
      "enabled":true,
      "vmHypervisor":false,
      "containerHypervisor":false,
      "displayOrder":2,
      "selectable":false,
      "controlPower":true,
      "controlSuspend":true,
      "hasAgent":true,
      "creatable":true,
      "optionTypes":[

      ]
    },
    {
      "id":8,
      "code":"openstackLinux",
      "name":"Openstack Linux Node",
      "description":"",
      "platform":"linux",
      "nodeType":"morpheus-node",
      "managed":true,
      "enabled":true,
      "vmHypervisor":false,
      "containerHypervisor":false,
      "displayOrder":4,
      "selectable":false,
      "controlPower":true,
      "controlSuspend":true,
      "hasAgent":true,
      "creatable":true,
      "optionTypes":[
        {
          "name":"osUsr",
          "type":"text",
          "defaultValue":null,
          "placeHolder":null,
          "required":true,
          "fieldName":"osUsr",
          "fieldContext":"config"
        },
        {
          "name":"flavorId",
          "type":"selectOsFlavor",
          "defaultValue":null,
          "placeHolder":null,
          "required":true,
          "fieldName":"flavorId",
          "fieldContext":"config"
        },
        {
          "name":"imageId",
          "type":"selectOsImage",
          "defaultValue":null,
          "placeHolder":null,
          "required":true,
          "fieldName":"imageId",
          "fieldContext":"config"
        },
        {
          "name":"osNetworkId",
          "type":"selectOsNetwork",
          "defaultValue":null,
          "placeHolder":null,
          "required":true,
          "fieldName":"osNetworkId",
          "fieldContext":"config"
        },
        {
          "name":"diskSize",
          "type":"text",
          "defaultValue":null,
          "placeHolder":null,
          "required":true,
          "fieldName":"diskSize",
          "fieldContext":"config"
        },
        {
          "name":"templateTypeSelect",
          "type":"radio",
          "defaultValue":null,
          "placeHolder":null,
          "required":true,
          "fieldName":"templateTypeSelect",
          "fieldContext":"config"
        },
        {
          "name":"floatingIp",
          "type":"checkbox",
          "defaultValue":null,
          "placeHolder":null,
          "required":true,
          "fieldName":"floatingIp",
          "fieldContext":"config"
        },
        {
          "name":"osPwd",
          "type":"password",
          "defaultValue":null,
          "placeHolder":null,
          "required":true,
          "fieldName":"osPwd",
          "fieldContext":"config"
        },
        {
          "name":"diskMode",
          "type":"selectDiskMode",
          "defaultValue":null,
          "placeHolder":null,
          "required":true,
          "fieldName":"diskMode",
          "fieldContext":"config"
        },
        {
          "name":"securityGroup",
          "type":"selectOpenstackSecurityGroup",
          "defaultValue":null,
          "placeHolder":null,
          "required":true,
          "fieldName":"securityGroup",
          "fieldContext":"config"
        },
        {
          "name":"publicKeyId",
          "type":"keyPairSelect",
          "defaultValue":null,
          "placeHolder":null,
          "required":true,
          "fieldName":"publicKeyId",
          "fieldContext":"config"
        },
        {
          "name":"serverGroup",
          "type":"selectOpenstackServerGroup",
          "defaultValue":null,
          "placeHolder":null,
          "required":true,
          "fieldName":"serverGroup",
          "fieldContext":"config"
        }
      ]
    }
  ]
}

HTTP Request

GET https://api.gomorpheus.com/api/server-types

Query Parameters

Parameter Default Description
max 25 Max number of results to return
offset 0 Offset of records you want to load

Get a Specific Server Type

curl "https://api.gomorpheus.com/api/server-types/1" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "success": true,
  "serverType": {
    "id": 19,
    "code": "softlayerVm",
    "name": "Softlayer Instance",
    "description": "",
    "platform": "linux",
    "nodeType": "morpheus-vm-node",
    "managed": true,
    "enabled": true,
    "vmHypervisor": false,
    "containerHypervisor": false,
    "displayOrder": 0,
    "selectable": false,
    "controlPower": true,
    "controlSuspend": true,
    "hasAgent": true,
    "creatable": false,
    "optionTypes": []
  }
}

SSL Certificates

Morpheus provides a database for keeping track of SSL Certificates in the system. These can be applied to various load balancers within the system and instances that use them.

Get All SSL Certificates

curl "https://api.gomorpheus.com/api/certificates"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "certificateCount": 1,
  "certificates": [
    {
      "accountId": 1,
      "certFile": "certFileContent",
      "domainName": "test.local",
      "generated": false,
      "id": 1,
      "keyFile": "keyFileContent",
      "name": "Test Cert",
      "wildcard": true
    }
  ]
}

This endpoint retrieves all key pairs associated with the account.

HTTP Request

GET https://api.gomorpheus.com/api/certificates

Query Parameters

Parameter Default Description
lastUpdated null A date filter, restricts query to only load certificates updated more recent or equal to the date specified
name null If specified will return an exact match certificate

Get a Specific Certificate

curl "https://api.gomorpheus.com/api/certificates/1" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "certificate": {
    "accountId": 1,
    "certFile": "certFileContent",
    "domainName": "test.local",
    "generated": false,
    "id": 1,
    "keyFile": "keyFileContent",
    "name": "Test Cert",
    "wildcard": true
  },
  "succcess": true
}

This endpoint retrieves a specific key.

HTTP Request

GET https://api.gomorpheus.com/api/certificates/:id

URL Parameters

Parameter Description
ID The ID of the key pair to retrieve

Create a Certificate

curl -XPOST "https://api.gomorpheus.com/api/certificates" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"certificate":{
    "name": "My Cert",
    "certFile": "my cert file contents",
    "keyFile": "My keyfile",
    "domainName": "Domain name of cert",
    "wildcard": false
  }}'

The above command returns JSON structured like getting a single certificate:

HTTP Request

POST https://api.gomorpheus.com/api/certificates

JSON Check Parameters

Parameter Default Description
name null A unique name scoped to your account for the key
certFile null The contents of the certificate file
keyFile null The contents of the key file
wildcard false Wether or not this certificate is a wildcard cert
domainName null The domain name this certificate is tied to

Updating a Certificate

curl -XPUT "https://api.gomorpheus.com/api/certificates/1" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"certificate":{
    "name": "My Cert",
    "certFile": "my cert file contents",
    "keyFile": "My keyfile",
    "domainName": "Domain name of cert",
    "wildcard": false
  }}'

The above command returns JSON structured like getting a single certificate:

HTTP Request

PUT https://api.gomorpheus.com/api/certificates/:id

JSON Check Parameters

Parameter Default Description
name null A unique name scoped to your account for the key
certFile null The contents of the certificate file
keyFile null The contents of the key file
wildcard false Wether or not this certificate is a wildcard cert
domainName null The domain name this certificate is tied to

Delete a Certificate

curl -XDELETE "https://api.gomorpheus.com/api/certificates/1" \
  -H "Authorization: BEARER access_token"

The above command returns JSON Structured like this:

{
  "success": true
}

Will delete a certificate from the system and make it no longer usable.

Key Pairs

Morpheus provides a database for keeping track of Key Pairs in the system. These can be used for provisioning servers and auto assigning added keypairs.

Get All Key Pairs

curl "https://api.gomorpheus.com/api/key-pairs"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "keyPairCount": 1,
  "keyPairs": [
    {
      "accountId": 1,
      "id": 2,
      "name": "Test",
      "privateKey": null,
      "publicKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXhVj5Oe88bXPmNA32iZ0ijlgbTkeCgnTkLwDyGfOTBH56QR9gwU66B1mh+ceU/lm1jS0zNuHtGFiMabbL+7a+MgJ7HVuaV4CR2/a/cp1yEzvvuJE6IvoGzDiXIdafasdfxcvdfadfVcEyOn+TW16rbS6GR/IwuvS81GqSJ6Z5/IJh4R5IW5yzK6z6BTHtX+vQQN9xv60JmwBC1NO5UVps2KVDBSCildlNlPR4AFrtVYDPSjRmjvj3DjGnJ6YlgjFIgc23bk1t0pknocgkB+7QZrkt1ed6AWVojGTUo2B9Cd/MphCKfZ davydotcom@Davids-MacBook-Pro-2.local"
    }
  ],
  "success": true
}

This endpoint retrieves all key pairs associated with the account.

HTTP Request

GET https://api.gomorpheus.com/api/key-pairs

Query Parameters

Parameter Default Description
lastUpdated null A date filter, restricts query to only load keypairs updated more recent or equal to the date specified
name null If specified will return an exact match keypair

Get a Specific Key Pair

curl "https://api.gomorpheus.com/api/key-pairs/2" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "keyPair": {
    "accountId": 1,
    "id": 2,
    "name": "Test",
    "privateKey": null,
    "publicKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXhVj5Oe88bXPmNA32iZ0ijlgbTkeCgnTkLwDyGfOTBH56QR9gwU66B1mh+ceU/lm1jS0zNuHtGFiMabbL+7a+MgJ7HVuaV4CR2/a/cp1yEzvvuJE6IvoGzDiXIdafasdfxcvdfadfVcEyOn+TW16rbS6GR/IwuvS81GqSJ6Z5/IJh4R5IW5yzK6z6BTHtX+vQQN9xv60JmwBC1NO5UVps2KVDBSCildlNlPR4AFrtVYDPSjRmjvj3DjGnJ6YlgjFIgc23bk1t0pknocgkB+7QZrkt1ed6AWVojGTUo2B9Cd/MphCKfZ davydotcom@Davids-MacBook-Pro-2.local"
  },
  "success": true
}

This endpoint retrieves a specific key.

HTTP Request

GET https://api.gomorpheus.com/api/key-pairs/:id

URL Parameters

Parameter Description
ID The ID of the key pair to retrieve

Create a KeyPair

curl -XPOST "https://api.gomorpheus.com/api/key-pairs" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"keyPair":{
    "name": "My Key",
    "publicKey": "ssh-rsa",
    "privateKey": "privateKey Optional for most cases"
  }}'

The above command returns JSON structured like getting a single keyPair:

HTTP Request

POST https://api.gomorpheus.com/api/key-pairs

JSON Check Parameters

Parameter Default Description
name null A unique name scoped to your account for the key
publicKey null The public key pair value
privateKey null The private key pair value (optional)

NOTE The Public and Private key are stored in encrypted form in the database.

Delete a Key Pair

curl -XDELETE "https://api.gomorpheus.com/api/key-pairs/1" \
  -H "Authorization: BEARER access_token"

The above command returns JSON Structured like this:

{
  "success": true
}

Will delete a key pair from the system and make it no longer usable.

Accounts

Provides API interfaces for managing the creation and modification of accounts within Morpheus (Typically only accessible by the Master Account)

Get All Accounts

curl "https://api.gomorpheus.com/api/accounts"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "accounts": [
    {
      "id": 1,
      "name": "Root Account",
      "description": "The master account",
      "currency": "USD",
      "instanceLimits": null,
      "lastUpdated": "2015-11-10T18:58:55+0000",
      "dateCreated": "2015-11-10T18:58:55+0000",
      "role": {
        "id": 1,
        "authority": "System Admin",
        "description": "Super User"
      },
      "active": true
    }
  ],
  "meta": {
    "offset": 0,
    "max": 25,
    "size": 1,
    "total": 1
  }
}

This endpoint retrieves all accounts.

HTTP Request

GET https://api.gomorpheus.com/api/accounts

Query Parameters

Parameter Default Description
max 25 Max number of results to return
offset 0 Offset of records you want to load
sort name Sort order
direction asc Sort direction, use ‘desc’ to reverse sort
phrase null Filter by matching name or description
name null Filter by name
lastUpdated null Date filter, restricts query to only load accounts updated timestamp is more recent or equal to the date specified

Get a Specific Account

curl "https://api.gomorpheus.com/api/accounts/1" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "account": {
    "id": 1,
    "name": "Root Account",
    "description": "The master account",
    "currency": "USD",
    "instanceLimits": null,
    "externalId": null,
    "lastUpdated": "2015-11-10T18:58:55+0000",
    "dateCreated": "2015-11-10T18:58:55+0000",
    "role": {
      "id": 1,
      "authority": "System Admin",
      "description": "Super User"
    },
    "active": true
  }
}

This endpoint will retrieve a specific account by id if the user has permission to access it.

HTTP Request

GET https://api.gomorpheus.com/api/accounts/:id

Create an Account

curl -XPOST "https://api.gomorpheus.com/api/accounts" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"account":{
    "name": "My New Account",
    "description": "My description",
    "instanceLimits": {
      "maxCpu": 0,
      "maxMemory": 0,
      "maxStorage": 0
    },
    role: {
      id: 2
    }
  }}'

The above command returns JSON structured like getting a single account:

HTTP Request

POST https://api.gomorpheus.com/api/accounts

JSON Account Parameters

Parameter Default Description
name null A unique name for the account
description null Optional description field if you want to put more info there
role Account Admin A nested id of the default role for the account
instanceLimits null Optional JSON Map of maxCpu, maxMemory (bytes) and maxStorage (bytes) restrictions (0 means unlimited). The parameters maxMemoryMiB, maxMemoryGiB, maxStorageMiB and maxStorageGiB can be used to pass values in larger units.

Updating an Account

curl -XPUT "https://api.gomorpheus.com/api/accounts/2" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"account":{
    "name": "My New Account",
    "description": "My new description",
    "instanceLimits": {
      "maxCpu": 0,
      "maxMemory": 0,
      "maxStorage": 0
    },
    "role": {
      id: 3
    }
  }}'

The above command returns JSON structured like getting a single account:

HTTP Request

PUT https://api.gomorpheus.com/api/accounts/:id

JSON Account Parameters

Parameter Default Description
name null A unique name for the account
description null Optional description field if you want to put more info there
role null A nested id of the default role for the account
instanceLimits null Optional JSON Map of maxCpu, maxMemory (bytes) and maxStorage (bytes) restrictions (0 means unlimited). The parameters maxMemoryMiB, maxMemoryGiB, maxStorageMiB and maxStorageGiB can be used to pass values in larger units.

Delete an Account

curl -XDELETE "https://api.gomorpheus.com/api/accounts/1" \
  -H "Authorization: BEARER access_token"

The above command returns JSON Structured like this:

{
  "success": true
}

If an account still has users or instances tied to it, The delete will fail.

Users

Managing users via the API is always scoped to a specific account. Most of the API’s regarding user management require that the account Id of the user also be known

Get All Users for an Account

curl "https://api.gomorpheus.com/api/accounts/1/users"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "users": [
    {
      "id": 1,
      "accountId": 1,
      "username": "davydotcom",
      "displayName": "David Estes",
      "email": "destes@bcap.com",
      "firstName": "David",
      "lastName": "Estes",
      "dateCreated": "2015-11-10T18:58:55+0000",
      "lastUpdated": "2015-11-10T18:58:55+0000",
      "enabled": true,
      "accountExpired": false,
      "accountLocked": false,
      "passwordExpired": false,
      "role": {
        "id": 1,
        "authority": "System Admin",
        "description": "Super User"
      },
      "account": {
        "id": 1,
        "name": "Root Account"
      },
      "instanceLimits": null
    }
  ],
  "meta": {
    "offset": 0,
    "max": 25,
    "size": 1,
    "total": 1
  }
}

This endpoint retrieves all accounts.

HTTP Request

GET https://api.gomorpheus.com/api/accounts/:accountId/users

Query Parameters

Parameter Default Description
max 25 Max number of results to return
offset 0 Offset of records you want to load
sort name Sort order
direction asc Sort direction, use ‘desc’ to reverse sort order
phrase null Filter by matching firstName, lastName, username, or email
username null Filter by username
lastUpdated null Date filter, restricts query to only load users updated timestamp is more recent or equal to the date specified

Get a Specific User

curl "https://api.gomorpheus.com/api/accounts/1/users/1" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "user": {
    "id": 1,
    "accountId": 1,
    "username": "davydotcom",
    "displayName": "David Estes",
    "email": "destes@bcap.com",
    "firstName": "David",
    "lastName": "Estes",
    "dateCreated": "2015-11-10T18:58:55+0000",
    "lastUpdated": "2015-11-10T18:58:55+0000",
    "enabled": true,
    "accountExpired": false,
    "accountLocked": false,
    "passwordExpired": false,
    "role": {
      "id": 1,
      "authority": "System Admin",
      "description": "Super User"
    },
    "account": {
      "id": 1,
      "name": "Root Account"
    },
    "instanceLimits": null
  }
}

This endpoint will retrieve a specific user by id if the user has permission to access the user.

HTTP Request

GET https://api.gomorpheus.com/api/accounts/:accountId/users/:id

Create a User

curl -XPOST "https://api.gomorpheus.com/api/accounts/1/users" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"user":{
    "username": "testUser",
    "firstName": "Jane",
    "lastName": "Doe",
    "password": "abc123",
    "passwordConfirmation": "abc123",
    "role": {"id": 1},
    "instanceLimits": {
      "maxCpu": 0,
      "maxMemory": 0,
      "maxStorage": 0
    }
  }}'

The above command returns JSON structured like getting a single user:

HTTP Request

POST https://api.gomorpheus.com/api/accounts/:accountId/users

JSON User Parameters

Parameter Default Description
username null A unique username
email null The user’s email
firstName null The user’s first name (optional)
lastName null The user’s last name (optional)
password null The password to apply to the user
passwordConfirmation null The password again
role null A nested id of the role to assign to the user
instanceLimits null Optional JSON Map of maxCpu, maxMemory (bytes) and maxStorage (bytes) restrictions (0 means unlimited). The parameters maxMemoryMiB, maxMemoryGiB, maxStorageMiB and maxStorageGiB can be used to pass values in larger units.

Updating a User

curl -XPUT "https://api.gomorpheus.com/api/accounts/1/users/2" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"user":{
    "username": "testUser",
    "firstName": "Jane",
    "lastName": "Doe",
    "password": "abc123",
    "role": {"id": 1},
    "instanceLimits": {
      "maxCpu": 0,
      "maxMemory": 0,
      "maxStorage": 0
    }
  }}'

The above command returns JSON structured like getting a single user:

HTTP Request

PUT https://api.gomorpheus.com/api/accounts/:accountId/users/:id

JSON User Parameters

Parameter Default Description
username null A unique username
email null The user’s email
firstName null The user’s first name (optional)
lastName null The user’s last name (optional)
password null The password to apply to the user
passwordConfirmation null The password again
role null A nested id of the role to assign to the user
instanceLimits null Optional JSON Map of maxCpu, maxMemory (bytes) and maxStorage (bytes) restrictions (0 means unlimited). The parameters maxMemoryMiB, maxMemoryGiB, maxStorageMiB and maxStorageGiB can be used to pass values in larger units.

Delete a User

curl -XDELETE "https://api.gomorpheus.com/api/accounts/1/users/2" \
  -H "Authorization: BEARER access_token"

The above command returns JSON Structured like this:

{
  "success": true
}

This will disassociate the user from any instances they have previously provisioned.

Roles

Provides API interfaces for managing the creation and modification of roles within Morpheus. This API is scoped to the roles owned by the current user’s account. System Admin users will also be able to access the system roles: System Admin and Account Admin.

Get All Roles

curl "https://api.gomorpheus.com/api/roles"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "roles": [
        {
      "id": 2,
      "authority": "Account Admin",
      "description": "Service account holder",
      "dateCreated": "2016-08-27T23:26:19+0000",
      "lastUpdated": "2016-08-27T23:26:19+0000",
      "scope": "Account",
      "instanceLimits": null,
      "ownerId": null,
      "owner": null
    },
    {
      "id": 1,
      "authority": "System Admin",
      "description": "Super User",
      "dateCreated": "2015-11-10T18:58:55+0000",
      "lastUpdated": "2015-11-10T18:58:55+0000",
      "scope": "Admin",
      "instanceLimits": null,
      "ownerId": null,
      "owner": null
    },
    {
      "id": 3,
      "authority": "Another Role",
      "description": "A custom role",
      "dateCreated": "2015-11-10T19:01:45+0000",
      "lastUpdated": "2015-11-10T19:02:01+0000",
      "scope": "Account",
      "instanceLimits": null,
      "ownerId": 1,
      "owner": {
        "id": 1,
        "name": "Root Account"
      }
    },
  ],
  "meta": {
    "offset": 0,
    "max": 25,
    "size": 3,
    "total": 3
  }
}

This endpoint retrieves all roles.

HTTP Request

GET https://api.gomorpheus.com/api/roles

Query Parameters

Parameter Default Description
max 25 Max number of results to return
offset 0 Offset of records you want to load
phrase null Filter by matching authority
authority null Filter by authority

Get a Specific Role

curl "https://api.gomorpheus.com/api/roles/3" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
    "role": {
    "id": 3,
    "authority": "Another Role",
    "description": "A custom role",
    "dateCreated": "2015-11-10T19:01:45+0000",
    "lastUpdated": "2015-11-10T19:02:01+0000",
    "scope": "Account",
    "instanceLimits": null,
    "ownerId": 1,
    "owner": {
      "id": 1,
      "name": "Root Account"
    }
  },
  "featurePermissions": [
    {
      "id": 8,
      "code": "admin-users",
      "name": "Admin: Users",
      "access": "full"
    },
    {
      "id": 18,
      "code": "backups",
      "name": "Backups",
      "access": "full"
    },
    {
      "id": 19,
      "code": "dashboard",
      "name": "Dashboard",
      "access": "read"
    },
  ],
  "globalSiteAccess": "custom",
  "sites": [
    {
      "id": 1,
      "name": "group1",
      "access": "full"
    },
    {
      "id": 2,
      "name": "group2",
      "access": "none"
    }
  ],
  "globalZoneAccess": "full",
  "zones": [
    {
      "id": 1,
      "name": "zone1",
      "access": "full"
    },
    {
      "id": 2,
      "name": "zone2",
      "access": "full"
    },
  ],
  "globalInstanceTypeAccess": "custom",
  "instanceTypePermissions": [
    {
      "id": 1,
      "code": "activemq",
      "name": "ActiveMQ",
      "access": "full"
    },
    {
      "id": 2,
      "code": "amazon",
      "name": "Amazon",
      "access": "full"
    },
    {
      "id": 5,
      "code": "ansible",
      "name": "Ansible",
      "access": "full"
    },
  ]
}

The sample JSON above shows only a small subset of the featurePermissions and instanceTypePermissions that exist.

This endpoint will retrieve a specific role by id if the user has permission to access the role.

HTTP Request

GET https://api.gomorpheus.com/api/roles/:id

Create a Role

curl -XPOST "https://api.gomorpheus.com/api/roles" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"role":{
    "authority": "Test Role",
    "description": "A test role",
    "baseRoleId": {"id": 2},
    "instanceLimits": {
      "maxCpu": 0,
      "maxMemory": 0,
      "maxStorage": 0
    }
  }}'

The above command returns JSON structured like getting a single role:

HTTP Request

POST https://api.gomorpheus.com/api/roles

JSON Role Parameters

Parameter Default Description
authority null A name for the role
description null Optional description field if you want to put more info there
baseRoleId null A role to copy feature permissions and access from (optional)
instanceLimits null Optional JSON Map of maxCpu, maxMemory (bytes) and maxStorage (bytes) restrictions (0 means unlimited). The parameters maxMemoryMiB, maxMemoryGiB, maxStorageMiB and maxStorageGiB can be used to pass values in larger units.

Updating Basic Role Settings

curl -XPUT "https://api.gomorpheus.com/api/roles/4" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{"role":{
    "authority": "Test Role",
    "description": "A new description of test role",
    "instanceLimits": {
      "maxCpu": 0,
      "maxMemory": 0,
      "maxStorage": 0
    }
  }}'

The above command returns JSON structured like getting a single role:

HTTP Request

PUT https://api.gomorpheus.com/api/roles/:id

JSON Role Parameters

Parameter Default Description
authority null A name for the role
description null Optional description field if you want to put more info there
instanceLimits null Optional JSON Map of maxCpu, maxMemory (bytes) and maxStorage (bytes) restrictions (0 means unlimited). The parameters maxMemoryMiB, maxMemoryGiB, maxStorageMiB and maxStorageGiB can be used to pass values in larger units.

Updating Role Feature Permissions

curl -XPUT "https://api.gomorpheus.com/api/roles/4/update-permission" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{
    "permissionCode": "admin-users",
    "access": "read"
  }'

The above command returns JSON Structured like this:

{
  "success": true,
  "access": "read"
}

HTTP Request

PUT https://api.gomorpheus.com/api/roles/:id/update-permission

JSON Parameters

Parameter Default Description
permissionCode The code of the permission being changed
access The new access level. full, read, none

Global Group Access

Global Group Access is controlled via the update-permission API

curl -XPUT "https://api.gomorpheus.com/api/roles/4/update-permission" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{
    "permissionCode": "ComputeSite",
    "access": "custom"
  }'

JSON Parameters

Parameter Default Description
permissionCode ComputeSite is the code for Global Group Access
access full, custom, read, or none

Customizing Group Access

Global Group Access must first be changed to custom as seen above.

curl -XPUT "https://api.gomorpheus.com/api/roles/4/update-group" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{
    "groupId": 2,
    "access": "full"
  }'

The above command returns JSON Structured like this:

{
  "success": true,
  "access": "full"
}

HTTP Request

PUT https://api.gomorpheus.com/api/roles/:id/update-group

JSON Parameters

Parameter Default Description
groupId id of the group (site)
access full, read, or none

Global Cloud Access

Global Cloud Access is controlled via the update-permission API

curl -XPUT "https://api.gomorpheus.com/api/roles/4/update-permission" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{
    "permissionCode": "ComputeZone",
    "access": "custom"
  }'

JSON Parameters

Parameter Default Description
permissionCode ComputeZone is the code for Global Cloud Access
access full, custom, or none

Customizing Cloud Access

Global Cloud Access must first be changed to custom as seen above.

curl -XPUT "https://api.gomorpheus.com/api/roles/4/update-cloud" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{
    "cloudId": 2,
    "access": "full"
  }'

The above command returns JSON Structured like this:

{
  "success": true,
  "access": "full"
}

HTTP Request

PUT https://api.gomorpheus.com/api/roles/:id/update-group

JSON Parameters

Parameter Default Description
cloudId id of the cloud (zone)
access full, read, or none

Global Instance Type Access

Global Instance Type Access is controlled via the update-permission API

curl -XPUT "https://api.gomorpheus.com/api/roles/4/update-permission" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{
    "permissionCode": "InstanceType",
    "access": "custom"
  }'

JSON Parameters

Parameter Default Description
permissionCode InstanceType is the code for Global Instance Type Access
access full, custom, or none

Customizing Instance Type Access

Global Instance Type Access must first be changed to custom as seen above.

curl -XPUT "https://api.gomorpheus.com/api/roles/4/update-instance-type" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceTypeId": 1,
    "access": "full"
  }'

The above command returns JSON Structured like this:

{
  "success": true,
  "access": "full"
}

HTTP Request

PUT https://api.gomorpheus.com/api/roles/:id/update-instance-type

JSON Parameters

Parameter Default Description
instanceTypeId id of the instance type
access full or none

Delete a Role

curl -XDELETE "https://api.gomorpheus.com/api/roles/4" \
  -H "Authorization: BEARER access_token"

The above command returns JSON Structured like this:

{
  "success": true
}

If a role still has accounts or users tied to it, The delete will fail.

Errors

The Morpheus API uses the following error codes:

Error Code Meaning
400 Bad Request – Your request sucks
401 Unauthorized – Your API key is wrong
403 Forbidden – The kitten requested is hidden for administrators only
404 Not Found – The specified kitten could not be found
405 Method Not Allowed – You tried to access a kitten with an invalid method
406 Not Acceptable – You requested a format that isn’t json
410 Gone – The entity requested has been removed from our servers
418 I’m a teapot
429 Too Many Requests – You’re requesting too many kittens! Slow down!
500 Internal Server Error – We had a problem with our server. Try again later.
503 Service Unavailable – We’re temporarially offline for maintanance. Please try again later.

Security Groups

A Security Group is a grouping of rules. Each rule is a whitelist entry for a particular IP address to either a port range or a particular Morpheus instance type. A Security Group may be applied to multiple Clouds, Apps, and Instances.

Get All Security Groups

curl "https://api.gomorpheus.com/api/security-groups"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "success": true,
  "securityGroups": [
    {
      "id": 19,
      "accountId": 1,
      "name": "All Access to Tomcat",
      "description": ""
    },
    {
      "id": 18,
      "accountId": 1,
      "name": "Colorado office",
      "description": "All the Colorado office to access anywhere"
    }
  ],
  "securityGroupCount": 2
}

This endpoint retrieves all security groups and their JSON encoded configuration attributes.

HTTP Request

GET https://api.gomorpheus.com/api/security-groups

Query Parameters

Parameter Default Description
max 25 Max number of results to return
offset 0 Offset of records you want to load
phrase null Name or description filter, restricts query to only load security groups which contain the phrase specified

Get a Specific Security Group

curl "https://api.gomorpheus.com/api/security-group/18" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "success": true,
  "securityGroup": {
    "id": 18,
    "accountId": 1,
    "name": "Colorado office",
    "description": "All the Colorado office to access anywhere"
  }
}

This endpoint retrieves a specific security group.

Create a Security Group

curl -XPOST "https://api.gomorpheus.com/api/security-group" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{ "securityGroup": {
  "name": "My New Security Group",
  "description": "My Description"}
  }

The above command returns a similar JSON structure when submitting a GET request for a single security group

HTTP Request

POST https://api.gomorpheus.com/api/security-group

JSON Security Group Parameters

Parameter Default Description
name null Name for your security group
description null Optional description field

Updating a Security Group

curl -XPUT "https://api.gomorpheus.com/api/security-group/18" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{ "securityGroup": {
  "name": "My New Security Group",
  "description": "My Description"
  }}'

The above command returns a similar JSON structure when submitting a GET request for a single security group

HTTP Request

PUT https://api.gomorpheus.com/api/security-group/:id

JSON Security Group Parameters

Parameter Default Description
name null Name for your security group
description null Optional description field

Delete a Security Group

curl -XDELETE "https://api.gomorpheus.com/api/security-group/1" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true
}

Will delete a security group and update all clouds, apps, and instances which are currently using the security group.

HTTP Request

DELETE https://api.gomorpheus.com/api/security-group/:id

Security Group Rules

A Security Group Rule specifies that a certain CIDR is able to access a particular port (or port range) for a particular protocol. Or, that a particular CIDR is able to access all instances of a particular type (like MySql, Redis, etc). A Security Group Rule belongs to a Security Group and a Security Group is applied to either a Cloud, App, or Instance.

Get All Security Group Rules for a Security Group

curl "https://api.gomorpheus.com/api/security-groups/19/rules"
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "success": true,
  "rules": [
    {
      "id": 31,
      "securityGroupId": 19,
      "source": "50.22.10.10/32",
      "portRange": null,
      "protocol": null,
      "customRule": false,
      "instanceTypeId": 3
    },
    {
      "id": 30,
      "securityGroupId": 19,
      "source": "50.22.10.10/32",
      "portRange": "99",
      "protocol": "tcp",
      "customRule": true,
      "instanceTypeId": null
    }
  ]
}

This endpoint retrieves all security group rules for a Security Gorup.

HTTP Request

GET https://api.gomorpheus.com/api/security-groups/:id/rules

Get a Specific Security Group Rule

curl "https://api.gomorpheus.com/api/security-group/19/rules/30" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structured like this:

{
  "success": true,
  "rule": {
    "id": 30,
    "securityGroupId": 19,
    "source": "50.22.10.10/32",
    "portRange": "99",
    "protocol": "tcp",
    "customRule": true,
    "instanceTypeId": null
  }
}

This endpoint retrieves a specific security group rule.

HTTP Request

GET https://api.gomorpheus.com/api/security-groups/:id/rules/:id

Create a Security Group Rule

curl -XPOST "https://api.gomorpheus.com/api/security-group/19/rules" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{ "rule": {
    "rule" : {
    "source": "50.22.10.10/32",
    "portRange": "55",
    "protocol": "tcp",
    "customRule": true,
    "instanceTypeId": 3}
    }
  }

The above command returns a similar JSON structure when submitting a GET request for a single security group rule

Will create a security group rule and update all clouds, apps, and instances which are currently using the security group in which this rule belongs.

HTTP Request

POST https://api.gomorpheus.com/api/security-group/:id/rules

JSON Security Group Rule Parameters

Parameter Default Description
source null CIDR representing the source IP(s) which should receive access
portRange null Either a single value (i.e. 55) or a port range (i.e. 1-65535) for which to open access to the source. Required if customRule is true, otherwise, ignored.
protocol null Either tcp, udp, icmp. Required if customRule is true, otherwise, ignored.
customRule null Either true or false. Specifies if this rule a custom rule (where source, portRange, and protocol are all required) or if it is tied to an Instance Type.
instanceTypeId null The id of an Instance Type. If specified, the source CIDR will have access to all ports exposed by the particular instance in the cloud, app, or instance. Required if customRule is false, otherwise, ignored.

Updating a Security Group Rule

curl -XPUT "https://api.gomorpheus.com/api/security-group/19/rules/30" \
  -H "Authorization: BEARER access_token" \
  -H "Content-Type: application/json" \
  -d '{ "rule": {
    "rule" : {
    "source": "50.22.10.10/32",
    "portRange": "55",
    "protocol": "tcp",
    "customRule": true,
    "instanceTypeId": 3}
    }
  }

The above command returns a similar JSON structure when submitting a GET request for a single security group rule

Will update a security group rule and update all clouds, apps, and instances which are currently using the security group in which this rule belongs.

HTTP Request

PUT https://api.gomorpheus.com/api/security-group/:id/rules/:id

JSON Security Group Rule Parameters

Same parameters as specified in the creation of a Security Group Rule

Delete a Security Group Rule

curl -XDELETE "https://api.gomorpheus.com/api/security-group/19/rules/30" \
  -H "Authorization: BEARER access_token"

The above command returns JSON structure like this:

{
  "success": true
}

Will delete a security group rule and update all clouds, apps, and instances which are currently using the security group in which this rule belongs.

HTTP Request

DELETE https://api.gomorpheus.com/api/security-group/:id/rules/:id