Introduction
Welcome to the Morpheus API Documentation.
Morpheus is a powerful cloud management tool that provides provisioning, monitoring, logging, backups, and application deployment strategies.
This document describes the Morpheus API protocol and the available endpoints. Sections are organized in the same manner as they appear in the Morpheus UI.
Sections
Section | Description |
---|---|
Authentication | Get Access Token, Refresh Access Token, Whoami, Forgot Password |
Operations | Dashboard, Reports, Wiki, Budgets, Approvals, Activity, Usage, Billing, Invoices, History, Health, Guidance |
Provisioning | Instances, Apps, Blueprints, Jobs, Automation, Virtual Images, Library, Deployments, Deploys |
Infrastructure | Groups, Clouds, Clusters, Hosts, Networks, Storage, Keys & Certs |
Logs | View logs for your hosts and containers. |
Monitoring | Checks, Incidents, Alerts, Contacts |
Tools | Cypher, Archives, Image Builder, Self Service |
Personas | Service Catalog |
Administration | Tenants, Roles, Users, Plans & Pricing, Policies, Settings, License, Ping, Setup |
To initialize a freshly installed Morpheus appliance, see Setup.
Version
You can determine your current version using Ping.
API
The Morpheus API is an HTTP interface for interacting with the Morpheus appliance. It provides a RESTful interface where GET
reads, POST
creates, PUT
updates and DELETE
destroys resources.
curl "$MORPHEUS_API_URL/api/users/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"user": {
"id": 1,
"accountId": 1,
"username": "admin",
"displayName": "Morpheus Admin",
"email": "admin@morpheusdata.com",
"firstName": "Morpheus",
"lastName": "Admin",
"dateCreated": "2017-03-16T21:26:39+0000",
"lastUpdated": "2019-10-30T23:09:01+0000",
"enabled": true,
"accountExpired": false,
"accountLocked": false,
"passwordExpired": false,
"loginCount": 86638,
"loginAttempts": 0,
"lastLoginDate": "2016-06-30T21:05:15+0000",
"roles": [
{
"id": 1,
"authority": "System Admin",
"description": "Super User"
}
],
"account": {
"id": 1,
"name": "root"
}
}
}
This is an example of a Morpheus API request that retrieves details about a User.
HTTP Request
GET https://api.gomorpheus.com/api/users/:id
HTTP Request describes the method and path of the endpoint. Most endpoints have a path formatted as /api/:resources/:id.
URL Parameters
Parameter | Description |
---|---|
:id | ID of the User. |
URL Parameters are variables which are included inside the path of the request.
HTTP Headers
Header | Description |
---|---|
Authorization | Use the format BEARER ${access_token} . Example: Authorization: BEARER e1d62c34-f7f5-4713-a874-31491e7707de . Most endpoints require this header. Some exceptions include Authentication and Setup. |
Content-Type | Use application/json for POST and PUT requests. This is needed to ensure your JSON payload is parsed. Exceptions to this rule include file uploads where application/x-www-form-urlencoded and application/octet-stream should be used instead. |
HTTP Headers are used to authorize the acting user via a valid access token, and to describe the type of content being sent, which is typically JSON.
Query Parameters
Parameter | Description |
---|---|
phrase | If specified will return a partial match on name. |
Query Parameters are variables included in the query string portion of the request url, after the ?
and they are delimited by &
. Be sure to html encode your parameters and values!
JSON Parameters
Parameter | Description |
---|---|
name | A unique string. |
JSON Parameters define the variables to be included in the body of the request. These are typically under the the context of an object, such as "contact"
.
HTTP Response
The HTTP status 200 OK will be returned when a request is successful and an HTTP Error status will be returned when a request fails.
Most endpoints respond with Content-Type: application/json and a body that contains JSON data.
This is an example of an API response that retrieves a Contact record by ID.
Example
curl "$MORPHEUS_API_URL/api/monitoring/contacts/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns HTTP 200 and JSON structured like this:
{
"contact": {
"id": 1,
"name": "Morpheus Admin",
"emailAddress": "admin@morpheusdata.com",
"smsAddresss": null
}
}
This is an example of a successful response that contains the specified record.
Error Example
curl "$MORPHEUS_API_URL/api/monitoring/contacts/999999" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns HTTP 404 and JSON structured like this:
{
"success": false,
"msg": "Contact not found for this account"
}
This is an example of a 404 error response returned when the specified record was not found.
Environment Variables
export MORPHEUS_API_URL="https://api.gomorpheus.com"
export MORPHEUS_API_TOKEN="e1d62c34-f7f5-4713-a874-31491e7707de"
The following environment variables are used throughout the examples in this document.
Environment Variable | Description |
---|---|
MORPHEUS_API_URL | The URL of your morpheus data appliance. Example: https://api.gomorpheus.com |
MORPHEUS_API_TOKEN | Your access token. Example: e1d62c34-f7f5-4713-a874-31491e7707de . See Get Access Token. |
Errors
When the Morpheus API encounters an error, the response will have an HTTP status of 400 of greater, instead of 200 OK. The error response body contains JSON with information to help troubleshoot the error.
400 Bad Request
curl -XPOST "$MORPHEUS_API_URL/api/contacts" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-d '{"contact":{"name":"example"}}'
The above command returns HTTP 400 and JSON structured like this:
{
"success": false,
"msg": "Unable to save contact",
"errors": {
"email": "Please enter a valid email address"
}
}
This error is returned if your request is invalid. Usually this is because a parameter is missing or the value is invalid. Try modifying your payload and retrying the request.
401 Unauthorized
curl "$MORPHEUS_API_URL/api/instances"
The above command returns HTTP 401 and JSON structured like this:
{
"error": "unauthorized",
"error_description": "Full authentication is required to access this resource"
}
The unauthorized error will be encountered unless you pass the authorization header.
curl "$MORPHEUS_API_URL/api/instances" \
-H "Authorization: BEARER BOGUS_TOKEN"
The above command returns HTTP 401 and JSON structured like this:
{
"error": "invalid_token",
"error_description": "Invalid access token: BOGUS_TOKEN"
}
The 401 error code is returned if your access token is invalid or expired.
403 Forbidden
curl "$MORPHEUS_API_URL/api/setup" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns HTTP 403 and JSON structured like this:
{
"success": false,
"msg": "You do not have permissions to access this api endpoint"
}
This error is seen if you try to access an endpoint without the required permissions.
For this error example, use the token of user that does not have any admin permissions.
404 Not Found
curl "$MORPHEUS_API_URL/api/foobar" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns HTTP 404 and JSON structured like this:
{
"success": false,
"msg": "Unable to find api endpoint GET /api/foobar"
}
This error indicates the specified endpoint path does not exist. Check the URL of your request and try again.
curl "$MORPHEUS_API_URL/api/apps/99999" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns HTTP 404 and JSON structured like this:
{
"success": false,
"msg": "App not found"
}
The 404 error code is returned if a resource could be not be found by the specified ID.
500 Internal Server Error
curl "$MORPHEUS_API_URL/api/test/500" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns HTTP 500 and JSON structured like this:
{
"success": false,
"msg": "Looks like the server threw a gasket"
}
This error indicates something went wrong with the request and an unexpected error has occured.
This example does not actually work and will return 404 instead. Hopefully you do not encounter a 500 error.
List of Error Codes
The Morpheus API uses the following error codes:
Error Code | Description |
---|---|
400 | Bad Request – Your request failed. Check your request parameters and try again. |
401 | Unauthorized – Your API key is invalid. Check your Authorization header. |
403 | Forbidden – Your API key does not have the required role or permissions. |
404 | Not Found – The specified resource could not be found. |
405 | Method Not Allowed – You tried to access a resource 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 asking too much of the server. 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. |
Programming Languages
The Morpheus API has development libraries available for use in several programming languages.
Language | Description |
---|---|
Shell | The Morpheus CLI gem provides the morpheus binary for scripting in any unix environment, or on Windows PowerShell. It also provides morpheus shell . |
Ruby | The Morpheus CLI gem provides the APIClient driver for interfacing with the API in ruby. |
Java | The Morpheus Java SDK is available for integration in Java or Groovy. |
Go | The Morpheus Go SDK is under development. |
Terraform | The Morpheus Terraform Provider is under development. |
Python | The Morpheus Python client is under development. |
Authentication
The Morpheus API uses an OAUTH 2.0 based authentication model.
Authentication is done by passing an access token in the Authorization HTTP header.
Use Get Access Token to acquire a valid access token.
Most /api
endpoints require authentication, and will respond with a HTTP 401 without a valid Authorization header.
Authorization Header
This header must be included in all requests that require authorization.
Header | Description |
---|---|
Authorization | Identifies the Morpheus API access token in the format bearer access_token . Example: Authorization: bearer e1d62c34-f7f5-4713-a874-31491e7707de |
Get Access Token
curl -XPOST "$MORPHEUS_API_URL/oauth/token?grant_type=password&scope=write&client_id=morph-api" \
-d 'username=admin' -d 'password=foobar'
The above command returns JSON structured like this:
{
"access_token": "e1d62c34-f7f5-4713-a874-31491e7707de",
"refresh_token": "718cc628-b89f-43f5-bef7-f39887b47e68",
"token_type": "bearer",
"expires_in": 30463819,
"scope": "write"
}
This endpoint provides authentication via username and password of a morpheus User. The response includes a valid access token. If your current token is expired, a new one will be created and returned.
HTTP Request
POST https://api.gomorpheus.com/oauth/token
HTTP Headers
Header | Description |
---|---|
Content-Type | application/x-www-form-urlencoded must be passed, this endpoint does not accept application/json |
Query Parameters
Parameter | Default | Description |
---|---|---|
client_id | Client ID, use morph-api . Users may only have one access token per Client ID. The CLI uses morph-cli . |
|
grant_type | OAuth Grant Type, use password . |
|
scope | OAuth token scope, use write . |
Request Parameters
Parameter | Default | Description |
---|---|---|
username | User username. Subtenant users will need to pass their subdomain prefix like domain\username . The default subdomain is the tenant account ID. Example: 2\neo |
|
password | User password |
Response
Name | Description |
---|---|
access_token | The access token for this user (scoped to client_id). |
refresh_token | The refresh token for this user (scoped to client_id). |
expires_in | The remaining seconds before the token expires. By default, access tokens are valid for 1 year or until it is refreshed. This time may vary depending on the client_id that is used. |
token_type | The token type, this will be bearer . |
scope | The scope, this will be write . |
Refresh Access Token
curl -XPOST "$MORPHEUS_API_URL/oauth/token?grant_type=refresh_token&client_id=morph-api&scope=write" \
-d 'refresh_token=718cc628-b89f-43f5-bef7-f39887b47e68'
The above command returns JSON structured like this:
{
"access_token": "e1d62c34-f7f5-4713-a874-31491e7707de",
"refresh_token": "718cc628-b89f-43f5-bef7-f39887b47e68",
"token_type": "bearer",
"expires_in": 30463819,
"scope": "write"
}
This endpoint allows refreshing your current access token to get a new token. This is done by passing your current refresh_token
.
This provides a way to renew your client’s session with the API, and extend the expiration date.
Your refresh_token
is returned by Get Access Token.
HTTP Request
POST https://api.gomorpheus.com/oauth/token
HTTP Headers
Header | Default | Description |
---|---|---|
Content-Type | Use application/x-www-form-urlencoded . |
Query Parameters
Parameter | Default | Description |
---|---|---|
client_id | Client ID, use morph-api . Users only have one access token per Client ID. |
|
grant_type | OAuth Grant Type, use refresh_token . |
|
scope | OAuth token scope, use write . |
Request Body
Parameter | Default | Description |
---|---|---|
refresh_token | Refresh Token, the current refresh token, scoped to Client ID. |
Response
Name | Description |
---|---|
access_token | The access token for this user, scoped to Client ID. |
refresh_token | The refresh token for this user, scoped to Client ID. |
expires_in | The remaining seconds before the token expires. By default, access tokens are valid for 1 year or until it is refreshed. |
token_type | The token type, this will be bearer . |
scope | The scope, this will be write . |
Whoami
curl "$MORPHEUS_API_URL/api/whoami" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"user": {
"id": 1,
"accountId": 1,
"username": "test",
"displayName": "Test U",
"email": "testuser@morpheusdata.com",
"firstName": "Test",
"lastName": "User",
"dateCreated": "2016-08-27T19:28:09+0000",
"lastUpdated": "2020-01-07T05:19:20+0000",
"enabled": true,
"accountExpired": false,
"accountLocked": false,
"passwordExpired": false,
"loginCount": 1575,
"loginAttempts": 0,
"lastLoginDate": "2020-01-07T05:19:20+0000",
"roles": [
{
"id": 5,
"authority": "Standard User",
"description": "A basic user role"
}
],
"account": {
"id": 1,
"name": "root"
},
"windowsUsername": "morphtest",
"linuxUsername": "morphtest"
},
"isMasterAccount": true,
"permissions": [
{
"name": "Provisioning: Blueprints",
"code": "app-templates",
"access": "full"
},
{
"name": "Provisioning: Apps",
"code": "apps",
"access": "full"
},
{
"name": "Logs",
"code": "logs",
"access": "full"
},
{
"name": "Monitoring",
"code": "monitoring",
"access": "full"
},
{
"name": "Operations: Wiki",
"code": "operations-wiki",
"access": "full"
},
{
"name": "Provisioning: Instances",
"code": "provisioning",
"access": "full"
},
{
"name": "Operations: Reports",
"code": "reports",
"access": "full"
},
{
"name": "Provisioning: Tasks - Script Engines",
"code": "task-scripts",
"access": "full"
},
{
"name": "Provisioning: Tasks",
"code": "tasks",
"access": "full"
},
{
"name": "Remote Console: Auto Login",
"code": "terminal-access",
"access": "yes"
},
{
"name": "Remote Console",
"code": "terminal",
"access": "full"
},
{
"name": "Provisioning: Blueprints - Terraform",
"code": "terraform-template",
"access": "full"
},
{
"name": "Provisioning: Virtual Images",
"code": "virtual-images",
"access": "full"
}
],
"appliance": {
"buildVersion": "4.1.2"
}
}
Provides API to retrieve information about yourself, including your roles and permissions.
The appliance build version is also returned.
HTTP Request
GET https://api.gomorpheus.com/api/whoami
Forgot Password Email
curl -XPOST "$MORPHEUS_API_URL/api/forgot/send-email" \
-H "Content-Type: application/json" \
-d '{
"username": "example"
}'
The above command returns JSON structured like this:
{
"success": true,
"msg": "Reset password instructions have been sent to the user 'example', if they exist."
}
This endpoint will trigger the Reset your password email to be sent to the specified user.
The User is identified by username
and, if they exist, will be notified via their configured email address. The email notification will indicate a Reset Password Request was made and it will include a token.
Once you obtain the token from the email, it may be used to reset the password of your user.
HTTP Request
POST https://api.gomorpheus.com/api/forgot/send-email
Request Parameters
Parameter | Default | Description |
---|---|---|
username | Username of the User who would like to reset their password. Subtenant users will need to pass their subdomain prefix like domain\username . The default subdomain is the tenant account ID. Example: 2\neo |
Reset Password
curl -XPOST "$MORPHEUS_API_URL/api/forgot/reset-password" \
-H "Content-Type: application/json" \
-d '{
"token": "3d0e0f652f884196b2349756b89f3dfd"
"password": "WywCx@L5rM5f3W^a"
}'
The above command returns JSON structured like this:
{
"success": true,
"msg": "Password has been updated and account unlocked"
}
This endpoint will reset the password for a user, updating it to the specified value. A secret token
must be passed to identify the user who is being updated.
HTTP Request
POST https://api.gomorpheus.com/api/forgot/reset-password
Request Parameters
Parameter | Default | Description |
---|---|---|
token | The secret Reset Password token that was included in the Forgot Password Email. | |
password | User new password. This is the new password for your user |
Operations
The Operations API endpoints provide insight into the Morpheus appliance, activity, reports and approvals. Documentation can be viewed and modified via the Wiki API.
Dashboard
curl "$MORPHEUS_API_URL/api/dashboard" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"success": true,
"monitoring": {
"avgHealth": 8.3333333333,
"avgResponseTime": 22.3333333333,
"warningApps": 0,
"warningChecks": 0,
"failApps": 0,
"totalApps": 2,
"failChecks": 1,
"successApps": 2,
"mutedApps": 0,
"successChecks": 5,
"totalChecks": 6,
"mutedChecks": 0,
"responseTimes": [
0,
2,
2,
125,
5,
0,
0
],
"allSuccess": false,
"openIncidents": 0
},
"provisioning": {
"instanceCount": 3,
"favoriteInstances": [
{
"id": 319,
"accountId": 1,
"instanceType": {
"id": 6,
"code": "apache",
"category": "web",
"name": "Apache"
},
"zones": [
{
"id": 40,
"accountId": 1,
"groups": [
1
],
"name": "qa-azure2",
"description": null,
"location": null,
"visibility": "private",
"zoneTypeId": 9
}
],
"layout": {
"id": 1292,
"code": "apache-azure-2.4-ubuntu-16.04-single",
"name": "Azure Apache",
"description": "This will provision a single process with no redundancy",
"sortOrder": 10
},
"plan": {
"name": "Basic_A0 (1 Core, 0.75GB Memory) (westus)",
"id": 187,
"code": "azure.plan.westus.Basic_A0"
},
"name": "test-azureapache1",
"displayName": "test-azureapache1",
"description": null,
"dateCreated": "2019-09-18T16:07:47Z",
"lastUpdated": "2019-10-25T09:12:29Z",
"status": "unknown",
"containerIds": [
317
],
"containers": [
{
"ip": "0.0.0.0",
"port": {
"id": 19,
"exportName": "HTTP",
"container": {
"id": 317
},
"loadBalancerInstance": null,
"primaryPort": false,
"loadBalanceProtocol": null,
"linkPort": true,
"internalPort": 80,
"export": true,
"portType": {
"id": 8
},
"displayName": "Http",
"protocol": "http",
"portIndex": 0,
"externalIp": null,
"externalPort": 80,
"internalIp": null,
"visible": true,
"loadBalance": true
}
}
],
"version": "2.4",
"environmentPrefix": null
}
]
},
"instanceStats": {
"usedMemory": 479804000,
"maxMemory": 1771446368,
"usedStorage": 6202490880,
"maxStorage": 55530786816,
"running": 2,
"total": 3,
"totalContainers": 4
},
"backups": {
"accountStats": {
"totalSizeByDay": [
0,
0,
0,
0,
0
],
"totalSizeByDay7Days": [
0,
0,
0,
0,
0,
0,
0
],
"formattedTotalSize": {
"value": "0",
"units": "KB"
},
"backupCount": 3,
"totalSize": 0,
"success": 0,
"failed": 0,
"totalCompleted": 0,
"avgSize": 0,
"failedRate": 0,
"successRate": 0,
"nextFireTotal": 1,
"backupDayCount": [
0,
0,
0,
0,
0,
0,
0
],
"backupDayCountTotal": 0
}
},
"activity": [
{
"success": false,
"name": "dev-appliance",
"message": "Check successfully been created.",
"ts": "2019-10-22T00:06:20Z",
"activityType": "Monitoring",
"accountId": 1,
"userId": 1,
"userName": "admin",
"objectId": 238,
"objectType": "MonitorCheck",
"_id": "0276e1fc-214d-4cb3-bcf4-9ebda0b26542",
"timestamp": "2019-10-22T00:06:20Z"
},
{
"success": true,
"name": "admin",
"message": "User 'admin' updated. Password changed.",
"ts": "2019-10-08T21:17:52Z",
"activityType": "Admin",
"accountId": 1,
"userId": 1,
"userName": "admin",
"objectId": 96,
"objectType": "User",
"_id": "26976fe0-a722-4d20-9849-9405a95d0db9",
"timestamp": "2019-10-08T21:17:52Z"
}
]
}
This endpoint can be used to view dashboard information about the remote Morpheus appliance. This is an overview and summary of data available to the user that can be used to render a dashboard.
HTTP Request
GET https://api.gomorpheus.com/api/dashboard
Reports
Provides API interfaces for viewing report results and executing new reports.
Get All Report Types
curl "$MORPHEUS_API_URL/api/report-types" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"reportTypes": [
{
"id": 21,
"code": "appCost",
"name": "Application Cost",
"category": "cost",
"dateCreated": "2018-05-02T07:44:46+0000",
"optionTypes": [
{
"id": 1073,
"name": "endDate",
"code": "reportType.endDate",
"description": null,
"fieldName": "endDate",
"fieldLabel": "End Date",
"fieldContext": "report",
"fieldGroup": null,
"fieldClass": null,
"fieldAddOn": null,
"fieldComponent": null,
"placeHolder": null,
"helpBlock": "",
"defaultValue": null,
"optionSource": null,
"type": "text",
"advanced": false,
"required": true,
"editable": true,
"creatable": null,
"config": {
},
"displayOrder": 2,
"wrapperClass": null,
"enabled": true,
"noBlank": false,
"dependsOnCode": null,
"contextualDefault": false
}
]
},
{
"id": 26,
"code": "workloadSummary",
"name": "Workload Summary",
"category": "provisioningInventory",
"dateCreated": "2018-09-10T08:18:04+0000",
"optionTypes": [
]
}
],
"meta": {
"size": 18,
"total": 18,
"offset": 0,
"max": 25
}
}
This endpoint retrieves all available report types. A report type has optionTypes
that define the parameters available when executing a report of that type. The sample response has been abbreviated.
HTTP Request
GET https://api.gomorpheus.com/api/report-types
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 | If specified will return a partial match on name | |
name | If specified will return an exact match on name | |
code | If specified will return an exact match on code | |
category | If specified will return an exact match on category |
Get All Reports
curl "$MORPHEUS_API_URL/api/reports" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"reportResults": [
{
"id": 2,
"type": {
"id": 21,
"code": "appCost",
"name": "Application Cost"
},
"reportTitle": "Application Cost Jun 04, 2019 19:28:02",
"filterTitle": "Jun 04, 2019",
"status": "ready",
"dateCreated": "2019-06-04T23:28:02+0000",
"lastUpdated": "2019-06-04T23:28:02+0000",
"startDate": null,
"endDate": null,
"config": {
"type": "appCost"
},
"createdBy": {
"id": 1,
"username": "root"
}
{
"id": 1,
"type": {
"id": 6,
"code": "groupInventory",
"name": "Group Inventory Summary"
},
"reportTitle": "Group Inventory Summary Jul 12, 2019 16:30:04",
"filterTitle": "Jul 12, 2019 | All Clouds | foo:bar",
"status": "ready",
"dateCreated": "2019-07-12T20:30:04+0000",
"lastUpdated": "2019-07-12T20:30:04+0000",
"startDate": null,
"endDate": null,
"config": {
"reportType": "groupInventory",
"cloudId": "",
"environment": "",
"tagName": "foo",
"tagValue": "bar"
},
"createdBy": {
"id": 1,
"username": "root"
}
}
],
"meta": {
"size": 2,
"total": 2,
"offset": 0,
"max": 25
}
}
This endpoint returns all reports. This is results of reports that have been executed in the past.
HTTP Request
GET https://api.gomorpheus.com/api/reports
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, default is dateCreated with direction desc |
direction | asc | Sort direction, use 'desc’ to reverse sort |
phrase | If specified will return a partial match on name | |
name | If specified will return an exact match on name | |
reportType | If specified will return an exact match on report type code, accepts multiple values | |
category | If specified will return an exact match on report type category, accepts multiple values |
Get a Specific Report
curl "$MORPHEUS_API_URL/api/reports/2" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"reportResult": {
"id": 2,
"type": {
"id": 21,
"code": "appCost",
"name": "Application Cost"
},
"reportTitle": "Application Cost Jun 04, 2019 19:28:02",
"filterTitle": "Jun 04, 2019",
"status": "ready",
"dateCreated": "2019-06-04T23:28:02+0000",
"lastUpdated": "2019-06-04T23:28:02+0000",
"startDate": null,
"endDate": null,
"config": {
"type": "appCost"
},
"createdBy": {
"id": 1,
"username": "root"
},
"rows": [
{
"id": 536,
"section": "header",
"data": "{\"code\":\"totalCount\",\"name\":\"Apps\",\"value\":2",
"displayOrder": 0
},
{
"id": 535,
"section": "header",
"data": "{\"code\":\"totalCost\",\"name\":\"Total Cost\",\"value\":99.99,\"currency\":\"USD\"}",
"displayOrder": 0
},
{
"id": 534,
"section": "main",
"data": "{\"name\":\"testapp1\",\"cost\":0,\"price\":0,\"currency\":\"USD\"}",
"displayOrder": 0
},
{
"id": 533,
"section": "main",
"data": "{\"name\":\"testapp2\",\"cost\":99.99,\"price\":0,\"currency\":\"USD\"}",
"displayOrder": 1
}
]
}
}
This endpoint retrieves a specific report result. The response includes the result data as rows
which can be used to render the report.
HTTP Request
GET https://api.gomorpheus.com/api/reports/:id
URL Parameters
Parameter | Description |
---|---|
id | ID of the report result |
Download a Specific Report
curl "$MORPHEUS_API_URL/api/reports/download/2" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns
Content-Type: "application/octet-stream"
andContent-disposition: attachment;filename=reportTitle.json
.
This endpoint downloads a specific report result as a file attachment. The default file format is json
.
HTTP Request
GET https://api.gomorpheus.com/api/reports/download/:id(.:format)
URL Parameters
Parameter | Description |
---|---|
id | ID of the report result |
format | Format of the rendered report file, json or csv . The default is .json . |
Run a Report
curl -XPOST "$MORPHEUS_API_URL/api/reports" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"report": {
"type": "appCost",
"startDate": "2019-01-01",
"endDate": "2020-01-01"
}}'
The above command returns JSON structured like getting a single report:
This endpoint execute the specified report type and create a new report result.
HTTP Request
POST https://api.gomorpheus.com/api/reports
JSON Report Parameters
Parameter | Default | Description |
---|---|---|
type | The Report Type code to be executed. |
The available parameters vary by report type. Refer to the defined optionTypes
for each report.
JSON Common Report Parameters
Parameter | Default | Description |
---|---|---|
startDate | The start date for the report | |
endDate | The end date for the report | |
groupId | The Group ID filter for the report | |
cloudId | The Cloud ID filter for the report |
Delete a Report
curl -XDELETE "$MORPHEUS_API_URL/api/reports/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON Structured like this:
{
"success": true
}
This endpoint will delete a report result.
HTTP Request
DELETE https://api.gomorpheus.com/api/reports/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the report result. |
Wiki
Morpheus provides a way to create and edit documentation in the form of wiki pages. Wiki pages use the markdown format and can be categorized to group them with other pages. Instances, apps, servers, clouds and groups can have their own wiki page associated to them.
Get All Wiki Pages
curl "$MORPHEUS_API_URL/api/wiki/pages"
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"pages": [
{
"id": 1,
"name": "Home",
"urlName": "home",
"category": null,
"refId": null,
"refType": null,
"format": "markdown",
"content": "Welcome to the home page for this Morpheus wiki.",
"createdBy": {
"id": 1,
"username": "admin"
},
"updatedBy": {
"id": 1,
"username": "admin"
},
"dateCreated": "2019-06-27T16:55:59+0000",
"lastUpdated": "2019-06-27T16:55:59+0000"
},
{
"id": 2,
"name": "README",
"urlName": "info/readme",
"category": "info",
"refId": null,
"refType": null,
"format": "markdown",
"content": "A readme file for this local dev appliance.\nNeat.",
"createdBy": {
"id": 1,
"username": "admin"
},
"updatedBy": {
"id": 1,
"username": "admin"
},
"dateCreated": "2019-06-27T14:44:22+0000",
"lastUpdated": "2019-06-27T14:44:22+0000"
},
{
"id": 3,
"name": "My Group",
"urlName": "my-group",
"category": "groups",
"refId": 1,
"refType": "ComputeSite",
"format": "markdown",
"content": "#My Group\nThis is a test group",
"createdBy": {
"id": 1,
"username": "admin"
},
"updatedBy": {
"id": 1,
"username": "admin"
},
"dateCreated": "2019-06-28T01:41:45+0000",
"lastUpdated": "2019-06-28T01:41:45+0000"
}
],
"meta": {
"size": 2,
"total": 2,
"max": 25,
"offset": 0
}
}
This endpoint retrieves wiki pages associated with the account.
HTTP Request
GET https://api.gomorpheus.com/api/wiki/pages
Query Parameters
Parameter | Default | Description |
---|---|---|
name | If specified will return an exact match on name or urlName | |
phrase | If specified will return a partial match on name |
Get All Wiki Categories
curl "$MORPHEUS_API_URL/api/wiki/categories"
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"categories": [
{
"name": "apps",
"pageCount": 1
},
{
"name": "clouds",
"pageCount": 1
},
{
"name": "groups",
"pageCount": 1
},
{
"name": "info",
"pageCount": 1
},
{
"name": "instances",
"pageCount": 2
},
{
"name": "servers",
"pageCount": 2
}
]
}
This endpoint retrieves all categories associated with the account. The results are not paginated. The categories returned are those of the found pages.
HTTP Request
GET https://api.gomorpheus.com/api/wiki/categories
Query Parameters
Parameter | Default | Description |
---|---|---|
phrase | If specified will return a partial match on category name | |
pagePhrase | If specified will return a partial match on page name |
Get a Specific Wiki Page
curl "$MORPHEUS_API_URL/api/wiki/pages/2" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"page": {
"id": 1,
"name": "Home",
"urlName": "home",
"category": null,
"refId": null,
"refType": null,
"format": "markdown",
"content": "The home page for this wiki.",
"createdBy": {
"id": 1,
"username": "admin"
},
"updatedBy": {
"id": 1,
"username": "admin"
},
"dateCreated": "2019-06-27T16:55:59+0000",
"lastUpdated": "2019-06-27T16:55:59+0000"
}
}
This endpoint retrieves a specific wiki page.
HTTP Request
GET https://api.gomorpheus.com/api/wiki/pages/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the Wiki Page |
Create a Wiki Page
curl -XPOST "$MORPHEUS_API_URL/api/wiki/pages" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"page":{
"name": "Sample Doc",
"category": "info",
"content": "#Sample Doc\nA sample document in **markdown**."
}}'
The above command returns JSON structured like getting a single wiki page:
HTTP Request
POST https://api.gomorpheus.com/api/wiki/pages
JSON Page Parameters
Parameter | Default | Description |
---|---|---|
name | A unique name scoped to your account for the wiki page. | |
category | Optional category for grouping with other pages. | |
content | The content of the page (markdown). |
Update a Wiki Page
curl -XPUT "$MORPHEUS_API_URL/api/wiki/pages/4" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"page":{
"content": "#Sample Doc\nAn updated sample document in **markdown**.\nCheers!"
}}'
The above command returns JSON structured like getting a single wiki page
HTTP Request
PUT https://api.gomorpheus.com/api/wiki/pages/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the Wiki Page |
JSON Page Parameters
Parameter | Default | Description |
---|---|---|
name | A unique name scoped to your account for the wiki page. | |
category | Optional category for grouping with other pages. | |
content | The content of the page (markdown). |
Delete a Wiki Page
curl -XDELETE "$MORPHEUS_API_URL/api/wiki/pages/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like getting a single wiki page
Will delete a Wiki Page from the system.
HTTP Request
DELETE https://api.gomorpheus.com/api/wiki/pages/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the Wiki Page |
The above command returns JSON structure like this:
{
"success": true
}
Get a Wiki Page For Instance
curl "$MORPHEUS_API_URL/api/instances/1/wiki" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like getting a single wiki page.
This endpoint retrieves the wiki page for an instance. If its page does not yet exist, the response is still 200 OK with a body like “page”:null.
HTTP Request
GET https://api.gomorpheus.com/api/instances/:id/wiki
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the Instance |
Update a Wiki Page For Instance
curl -XPUT "$MORPHEUS_API_URL/instances/1/wiki" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"page":{
"content": "Lots of good information about this instance."
}}'
The above command returns JSON structured like getting a single wiki page:
This endpoint updates the wiki page for an instance. The page will be created if it does not yet exist.
HTTP Request
PUT https://api.gomorpheus.com/api/instances/:id/wiki
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the Instance |
JSON Page Parameters
Parameter | Default | Description |
---|---|---|
name | (instance name) | A unique name scoped to your account for the wiki page. |
content | The content of the page (markdown). |
Get a Wiki Page For App
curl "$MORPHEUS_API_URL/api/apps/1/wiki" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like getting a single wiki page.
This endpoint retrieves the wiki page for an app. If its page does not yet exist, the response is still 200 OK with a body like “page”:null.
HTTP Request
GET https://api.gomorpheus.com/api/apps/:id/wiki
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the App |
Update a Wiki Page For App
curl -XPUT "$MORPHEUS_API_URL/apps/1/wiki" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"page":{
"content": "Lots of good information about this app."
}}'
The above command returns JSON structured like getting a single wiki page:
This endpoint updates the wiki page for an app. The page will be created if it does not yet exist.
HTTP Request
PUT https://api.gomorpheus.com/api/apps/:id/wiki
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the App |
JSON Page Parameters
Parameter | Default | Description |
---|---|---|
name | (app name) | A unique name scoped to your account for the wiki page. |
content | The content of the page (markdown). |
Get a Wiki Page For Cluster
curl "$MORPHEUS_API_URL/api/clusters/1/wiki" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like getting a single wiki page.
This endpoint retrieves the wiki page for a cluster. If its page does not yet exist, the response is still 200 OK with a body like “page”:null.
HTTP Request
GET https://api.gomorpheus.com/api/clusters/:id/wiki
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the Cluster |
Update a Wiki Page For Cluster
curl -XPUT "$MORPHEUS_API_URL/clusters/1/wiki" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"page":{
"content": "Lots of good information about this cluster."
}}'
The above command returns JSON structured like getting a single wiki page:
This endpoint updates the wiki page for a cluster. The page will be created if it does not yet exist.
HTTP Request
PUT https://api.gomorpheus.com/api/clusters/:id/wiki
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the Cluster |
JSON Page Parameters
Parameter | Default | Description |
---|---|---|
name | (cluster name) | A unique name scoped to your account for the wiki page. |
content | The content of the page (markdown). |
Get a Wiki Page For Server
curl "$MORPHEUS_API_URL/api/servers/1/wiki" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like getting a single wiki page.
This endpoint retrieves the wiki page for a server. If its page does not yet exist, the response is still 200 OK with a body like “page”:null.
HTTP Request
GET https://api.gomorpheus.com/api/servers/:id/wiki
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the Server |
Update a Wiki Page For Server
curl -XPUT "$MORPHEUS_API_URL/servers/1/wiki" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"page":{
"content": "Lots of good information about this server."
}}'
The above command returns JSON structured like getting a single wiki page:
This endpoint updates the wiki page for a server. The page will be created if it does not yet exist.
HTTP Request
PUT https://api.gomorpheus.com/api/servers/:id/wiki
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the Server |
JSON Page Parameters
Parameter | Default | Description |
---|---|---|
name | (server name) | A unique name scoped to your account for the wiki page. |
content | The content of the page (markdown). |
Get a Wiki Page For Cloud
curl "$MORPHEUS_API_URL/api/zones/1/wiki" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like getting a single wiki page.
This endpoint retrieves the wiki page for a cloud. If its page does not yet exist, the response is still 200 OK with a body like “page”:null.
HTTP Request
GET https://api.gomorpheus.com/api/zones/:id/wiki
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the Cloud |
Update a Wiki Page For Cloud
curl -XPUT "$MORPHEUS_API_URL/zones/1/wiki" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"page":{
"content": "Lots of good information about this cloud."
}}'
The above command returns JSON structured like getting a single wiki page:
This endpoint updates wiki page for a cloud. The page will be created if it does not yet exist.
HTTP Request
PUT https://api.gomorpheus.com/api/zones/:id/wiki
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the Cloud |
JSON Page Parameters
Parameter | Default | Description |
---|---|---|
name | (cloud name) | A unique name scoped to your account for the wiki page. |
content | The content of the page (markdown). |
Get a Wiki Page For Group
curl "$MORPHEUS_API_URL/api/groups/1/wiki" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like getting a single wiki page.
This endpoint retrieves the wiki page for a group. If its page does not yet exist, the response is still 200 OK with a body like “page”:null.
HTTP Request
GET https://api.gomorpheus.com/api/groups/:id/wiki
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the Group |
Update a Wiki Page For Group
curl -XPUT "$MORPHEUS_API_URL/groups/1/wiki" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"page":{
"content": "Lots of good information about this group."
}}'
The above command returns JSON structured like getting a single wiki page:
This endpoint updates the wiki page for a group. The page will be created if it does not yet exist.
HTTP Request
PUT https://api.gomorpheus.com/api/groups/:id/wiki
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the Group |
JSON Page Parameters
Parameter | Default | Description |
---|---|---|
name | (group name) | A unique name scoped to your account for the wiki page. |
content | The content of the page (markdown). |
Budgets
Provides API interfaces for managing budgets.
Get All Budgets
curl "$MORPHEUS_API_URL/api/budgets" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"budgets": [
{
"id": 1,
"name": "sample budget",
"description": "a yearly budget",
"account": {
"id": 1,
"name": "root"
},
"refScope": "account",
"refType": null,
"refId": null,
"refName": "root",
"interval": "year",
"period": "year",
"year": "2020",
"resourceType": "all",
"timezone": "America/New_York",
"startDate": "2020-01-01T05:00:00+0000",
"endDate": "2021-01-01T04:59:59+0000",
"active": true,
"enabled": true,
"rollover": false,
"costs": [
1000.0
],
"averageCost": 83.33333333333333,
"totalCost": 1000.0,
"currency": "USD",
"warningLimit": null,
"overLimit": null,
"externalId": null,
"internalId": null,
"createdById": 1,
"createdByName": "Admin",
"updatedById": null,
"updatedByName": null,
"dateCreated": "2020-01-03T17:40:08+0000",
"lastUpdated": "2020-01-03T17:40:08+0000"
},
{
"id": 2,
"name": "my budget",
"description": "99 per month",
"account": {
"id": 1,
"name": "root"
},
"refScope": "account",
"refType": null,
"refId": null,
"refName": "root",
"interval": "month",
"period": "year",
"year": "2020",
"resourceType": "all",
"timezone": "America/New_York",
"startDate": "2020-01-01T05:00:00+0000",
"endDate": "2021-01-01T04:59:59+0000",
"active": true,
"enabled": true,
"rollover": false,
"costs": [
99.0,
99.0,
99.0,
99.0,
99.0,
99.0,
99.0,
99.0,
99.0,
99.0,
99.0,
99.0,
],
"averageCost": 99.0,
"totalCost": 1188.0,
"currency": "USD",
"warningLimit": null,
"overLimit": null,
"externalId": null,
"internalId": null,
"createdById": 1,
"createdByName": "Admin",
"updatedById": null,
"updatedByName": null,
"dateCreated": "2020-01-03T17:37:51+0000",
"lastUpdated": "2020-01-03T17:37:51+0000"
},
{
"id": 3,
"name": "quarters",
"description": "Quarterly budget for tenant Acme",
"account": {
"id": 1,
"name": "root"
},
"refScope": "tenant",
"refType": "Account",
"refId": 47,
"refName": "Acme",
"interval": "quarter",
"period": "year",
"year": "2020",
"resourceType": "all",
"timezone": "America/New_York",
"startDate": "2020-01-01T05:00:00+0000",
"endDate": "2021-01-01T04:59:59+0000",
"active": true,
"enabled": true,
"rollover": false,
"costs": [
250.0,
250.0,
250.0,
500.0,
],
"averageCost": 312.5,
"totalCost": 1250.0,
"currency": "USD",
"warningLimit": null,
"overLimit": null,
"externalId": null,
"internalId": null,
"createdById": 1,
"createdByName": "James D",
"updatedById": null,
"updatedByName": null,
"dateCreated": "2020-01-02T02:54:34+0000",
"lastUpdated": "2020-01-03T17:43:52+0000"
}
],
"meta": {
"size": 3,
"total": 3,
"offset": 0,
"max": 25
}
}
This endpoint retrieves all budgets.
HTTP Request
GET https://api.gomorpheus.com/api/budgets
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 | Filter by matching name | |
name | Filter by name |
Get a Specific Budget
curl "$MORPHEUS_API_URL/api/budgets/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"success": true,
"budget": {
"id": 1,
"name": "sample budget",
"description": "a yearly budget",
"account": {
"id": 1,
"name": "root"
},
"refScope": "account",
"refType": null,
"refId": null,
"refName": "root",
"interval": "year",
"period": "year",
"year": "2020",
"resourceType": "all",
"timezone": "America/New_York",
"startDate": "2020-01-01T05:00:00+0000",
"endDate": "2021-01-01T04:59:59+0000",
"active": true,
"enabled": true,
"rollover": false,
"costs": [
1000.0
],
"averageCost": 83.33333333333333,
"totalCost": 1000.0,
"currency": "USD",
"warningLimit": null,
"overLimit": null,
"externalId": null,
"internalId": null,
"createdById": 1,
"createdByName": "Admin",
"updatedById": null,
"updatedByName": null,
"dateCreated": "2020-01-03T17:40:08+0000",
"lastUpdated": "2020-01-03T17:40:08+0000",
"stats": {
"averageCost": 83.33,
"totalCost": 1000.0,
"currency": "USD",
"conversionRate": 1,
"intervals": [
{
"index": 0,
"year": "Y1",
"shortYear": "Y1",
"budget": 1000.0,
"cost": 15.1016
}
],
"current": {
"estimatedCost": 15.1,
"lastCost": 15.1
}
}
}
}
This endpoint will retrieve a specific budget by id.
HTTP Request
GET https://api.gomorpheus.com/api/budgets/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the budget |
Create a Budget
curl -XPOST "$MORPHEUS_API_URL/api/budgets" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"budget":{
"name": "sample budget",
"year": "2020",
"interval": "year",
"scope": "account",
"costs": [1000]
}}'
The above command returns JSON structured like getting a single budget:
This endpoint creates a new budget.
HTTP Request
POST https://api.gomorpheus.com/api/budgets
JSON Parameters
The following parameters are passed inside an object named budget
.
Parameter | Default | Description |
---|---|---|
name | A unique name for the budget | |
description | A description of the budget | |
period | year | Budget period, year |
year | 2020 | Budget period value, default is the current year. This can also be passed as custom along with a startDate and endDate. |
startDate | Start Date for custom period budgets, should be the first of a month. eg. 2021-01-01 |
|
endDate | End Date for custom period budgets, should be the last day of a month, and must be 12, 24, or 36 months after the start date. eg. 2021-12-31 |
|
interval | year | Budget interval, year , quarter , month . |
scope | The type of the scope for the budget, account , group , cloud , user . The default scope is account , which means the entire account. |
|
scopeTenantId | The Tenant ID to scope to, for use with "scope"=tenant . |
|
scopeGroupId | The Group ID to scope to, for use with "scope"=group . |
|
scopeCloudId | The Cloud ID to scope to, for use with "scope"=cloud . |
|
scopeUserId | The User ID to scope to, for use with "scope"=user . |
|
costs | Array of budget cost amounts that varies in length by interval. For interval year use [1000] . For interval quarter use [200,200,200,400] . For interval month use [99,99,99,99,99,99,99,99,99,99,99,299] (other 10 months omitted). Custom budgets of more than one year may have more cost values. When creating a new schedule, the default cost for a given interval is 0 so be sure to specify a cost for every interval when creating a new budget. |
Updating a Budget
curl -XPUT "$MORPHEUS_API_URL/api/budgets/:id" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"budget":{
"interval": "quarter",
"costs": [1000,1000,1000,2000]
}}'
The above command returns JSON structured like getting a single budget:
This endpoint updates a budget.
HTTP Request
PUT https://api.gomorpheus.com/api/budgets/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the budget |
JSON Parameters
The following parameters are passed inside an object named budget
.
Parameter | Default | Description |
---|---|---|
name | A unique name for the budget | |
description | A description of the budget | |
period | year | Budget period, year |
year | 2020 | Budget period value, default is the current year. This can also be passed as custom along with a startDate and endDate. |
startDate | Start Date for custom period budgets, should be the first of a month. eg. 2021-01-01 |
|
endDate | End Date for custom period budgets, should be the last day of a month, and must be exactly 12, 24, or 36 months after the start date. eg. 2021-12-31 |
|
interval | year | Budget interval, year , quarter , month . |
scope | The type of the scope for the budget, account , group , cloud , user . The default scope is account , which means the entire account. |
|
scopeTenantId | The Tenant ID to scope to, for use with "scope"=tenant . |
|
scopeGroupId | The Group ID to scope to, for use with "scope"=group . |
|
scopeCloudId | The Cloud ID to scope to, for use with "scope"=cloud . |
|
scopeUserId | The User ID to scope to, for use with "scope"=user . |
|
costs | Array of budget cost amounts that varies in length by interval. For interval year use [1000] . For interval quarter use [200,200,200,400] . For interval month use [99,99,99,99,99,99,99,99,99,99,99,299] (other 10 months omitted). Custom budgets of more than one year may have more cost values. When creating a new schedule, the default cost for a given interval is 0 so be sure to specify a cost for every interval when creating a new budget. |
Delete a Budget
curl -XDELETE "$MORPHEUS_API_URL/api/budgets/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON Structured like this:
{
"success": true
}
This endpoint deletes a budget from the system.
HTTP Request
DELETE https://api.gomorpheus.com/api/budgets/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the budget |
Approvals
Provides API interfaces for managing approvals within Morpheus
Get All Approvals
curl "$MORPHEUS_API_URL/api/approvals" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"approvals": [
{
"id": 3,
"name": "APPROVAL-0000003",
"internalId": null,
"externalId": null,
"externalName": null,
"requestType": "Instance Approval",
"account": {
"id": 1,
"name": "Stubby Toes Inc."
},
"approver": {
"id": 1,
"name": "Stubby Toes Inc."
},
"accountIntegration": null,
"status": "1 approved",
"errorMessage": null,
"dateCreated": "2019-11-07T02:35:15+0000",
"lastUpdated": "2019-11-07T02:35:15+0000",
"requestBy": "Stubby Toes"
}
],
"meta": {
"size": 1,
"total": 1,
"max": 25,
"offset": 0
}
}
This endpoint retrieves all approvals.
HTTP Request
GET https://api.gomorpheus.com/api/approvals
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 | Name, externalName and requestBy filter, restricts query to only load approvals which contain the phrase specified | |
name | Name filter, restricts query to only load approval matching name specified |
Get a Specific Approval
curl "$MORPHEUS_API_URL/api/approvals/3" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"approval": {
"id": 3,
"name": "APPROVAL-0000003",
"internalId": null,
"externalId": null,
"externalName": null,
"requestType": "Instance Approval",
"account": {
"id": 1,
"name": "Stubby Toes Inc."
},
"approver": {
"id": 1,
"name": "Stubby Toes Inc."
},
"accountIntegration": null,
"status": "1 cancelled",
"errorMessage": null,
"dateCreated": "2019-11-07T02:35:15+0000",
"lastUpdated": "2019-11-07T02:35:15+0000",
"requestBy": "Stubby Toes",
"approvalItems": [
{
"id": 3,
"name": null,
"externalId": null,
"externalName": null,
"internalId": null,
"approvedBy": "Stubby Toes",
"deniedBy": "Stubby Toes",
"status": "cancelled",
"errorMessage": null,
"dateCreated": "2019-11-07T02:35:15+0000",
"lastUpdated": "2019-11-18T21:00:25+0000",
"dateApproved": "2019-11-18T19:56:30+0000",
"dateDenied": null,
"approval": {
"id": 3
},
"reference": {
"id": 3,
"type": "instance",
"name": "dans-ubuntu-3",
"displayName": "dans-ubuntu-3"
}
}
]
}
}
This endpoint retrieves a specific approval.
HTTP Request
GET https://api.gomorpheus.com/api/approvals/:id
URL Parameters
Parameter | Description |
---|---|
id | ID of the approval |
Get a Specific Approval Item
curl "$MORPHEUS_API_URL/api/approval-items/3" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"approvalItem": {
"id": 3,
"name": null,
"externalId": null,
"externalName": null,
"internalId": null,
"approvedBy": "Stubby Toes",
"deniedBy": "Stubby Toes",
"status": "cancelled",
"errorMessage": null,
"dateCreated": "2019-11-07T02:35:15+0000",
"lastUpdated": "2019-11-18T21:00:25+0000",
"dateApproved": "2019-11-18T19:56:30+0000",
"dateDenied": null,
"approval": {
"id": 3
},
"reference": {
"id": 3,
"type": "instance",
"name": "dans-ubuntu-3",
"displayName": "dans-ubuntu-3"
}
}
}
This endpoint retrieves a specific approval item
HTTP Request
GET https://api.gomorpheus.com/api/approval-items/:id
URL Parameters
Parameter | Description |
---|---|
id | ID of the approval item |
Update an Approval Item
curl -XPUT "$MORPHEUS_API_URL/api/approval-items/3/approve" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"success": true
}
This endpoint updates a specific approval item based upon specified action
HTTP Request
PUT https://api.gomorpheus.com/api/approval-items/:id/:action
URL Parameters
Parameter | Required | Description |
---|---|---|
id | Y | ID of the approval item |
action | Y | Approval item action [approve, deny, cancel] |
Activity
This endpoint provides data about activity with the Morpheus appliance. User activity and other morpheus events can be seen here.
The most recent activity is returned by default.
Get All Activity
curl "$MORPHEUS_API_URL/api/activity" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"activity": [
{
"_id": "ed970f86-c2bd-4ea2-8c3e-37494c8d8c67",
"success": false,
"activityType": "Alert",
"name": "test check",
"message": "Check has successfully been deleted",
"objectId": 239,
"objectType": "MonitorCheck",
"user": {
"id": 22,
"username": "tester"
},
"timestamp": "2019-10-23T19:31:54Z"
},
{
"_id": "247f122a-2dd6-4d92-a945-9e1fc35d8e51",
"success": false,
"activityType": "Monitoring",
"name": "dev-appliance",
"message": "Check has successfully been updated.",
"objectId": 238,
"objectType": "MonitorCheck",
"user": {
"id": 1,
"username": "root"
},
"ts": "2019-10-22T07:55:49Z"
},
{
"_id": "0276e1fc-214d-4cb3-bcf4-9ebda0b26542",
"success": false,
"activityType": "Monitoring",
"name": "dev-appliance",
"message": "Check successfully been created.",
"objectId": 238,
"objectType": "MonitorCheck",
"user": {
"id": 1,
"username": "root"
},
"ts": "2019-10-22T00:06:20Z"
},
{
"_id": "26976fe0-a722-4d20-9849-9405a95d0db9",
"success": true,
"activityType": "Admin",
"name": "julius",
"message": "User 'julius' updated. Password changed.",
"objectId": 96,
"objectType": "User",
"user": {
"id": 1,
"username": "root"
},
"ts": "2019-10-08T21:17:52Z"
}
]
}
HTTP Request
GET https://api.gomorpheus.com/api/activity
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 |
order | asc | Sort direction, use ‘desc’ to reverse sort |
name | Filter by name | |
phrase | Filter by wildcard search of name and description | |
userId | Filter by User ID. | |
tenantId | Filter by Tenant ID. Only available to the master account. | |
timeframe | month | Filter by a timeframe. eg. today,yesterday,week,month,3months. |
start | (1 month ago) | Filter by activity on or after a date(time) |
end | (current time) | Filter by activity on or before a date(time) |
Usage
Provides endpoints for viewing a list of usage for all your Containers and Servers. Morpheus keeps track of resource usage as the periods of time it was on or off. A new usage record is created every time a resource is started or stopped. Each usage record includes the applied pricing and accumualated charges during the interval. Price is based on the assigned service plan.
This endpoint outputs usage data in the same format as the Billing api.
List Usages
curl "$MORPHEUS_API_URL/api/usage"
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"usages": [
{
"id": 28791,
"zoneName": "aws",
"name": "example",
"planName": "Amazon T2 Nano - 1 Core, 0.5GB Memory",
"startDate": "2020-10-26T16:48:54Z",
"endDate": "2020-10-26T17:00:37Z",
"status": "running",
"price": 0.001668677955115256,
"costDetails": {
"refType": "container",
"refUUID": "9287ee06-75c6-4772-840c-fab7b2d668bd",
"refId": 938,
"startDate": "2020-10-26T16:48:54Z",
"endDate": "2020-10-26T17:00:37Z",
"cost": 0.001668677955115256,
"price": 0.001668677955115256,
"numUnits": 0.195410555555,
"unit": "hour",
"currency": "USD",
"usages": [
{
"cost": 0.001668677955115256,
"price": 0.001668677955115256,
"createdByUser": "Test User",
"createdByUserId": 127,
"siteId": 1,
"siteName": "mygroup",
"siteUUID": "9a18a409-e3b7-438b-b3d8-e393652f7c60",
"siteCode": null,
"currency": "USD",
"startDate": "2020-10-26T16:48:54Z",
"endDate": "2020-10-26T17:00:37Z",
"status": "running",
"tags": [],
"applicablePrices": [
{
"startDate": "2020-10-26T16:48:54Z",
"endDate": "2020-10-26T17:00:37Z",
"numUnits": 0.195410555555,
"cost": 0.001668677955115256,
"price": 0.001668677955115256,
"currency": "USD",
"prices": [
{
"type": "compute",
"pricePerUnit": 0.0069,
"costPerUnit": 0.0069,
"cost": 0.0013483328333295,
"price": 0.0013483328333295,
"quantity": null
},
{
"type": "storage",
"pricePerUnit": 0.000163934424,
"costPerUnit": 0.000163934424,
"cost": 3.203451686842893e-05,
"price": 3.203451686842893e-05,
"quantity": 10
}
]
}
],
"servicePlanId": 1,
"servicePlanName": "Amazon T2 Nano - 1 Core, 0.5GB Memory"
}
],
"numUsages": 1,
"totalUsages": 1,
"hasMoreUsages": false,
"foundPricing": true
}
}
],
"meta": {
"size": 25,
"total": 28133,
"offset": 0,
"max": 25
}
}
This endpoint retrieves a paginated list of usage records. The usages are scoped to only include resources you have access to.
HTTP Request
GET https://api.gomorpheus.com/api/usage
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, default is startDate desc |
direction | asc | Sort direction: asc or desc |
phrase | Filter by wildcard search of resource name | |
type | Filter by a specific resource type: container, server, discoveredServer or loadBalancer | |
startDate | Filter by startDate greater than or equal to a specified date | |
endDate | Filter by endDate less than or equal to a specified date |
Billing
Provides API interfaces for viewing billing usage information by tenant, zone, instance or server. By default, usage is returned is from the beginning of the current month until now. The date range is parameterized but the end date cannot exceed the current date.
Billing By Tenant
curl "$MORPHEUS_API_URL/api/billing/account" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"success": true,
"billingInfo": {
"accountId": 1,
"name": "morpheus",
"startDate": "2017-02-01T07:00:00Z",
"endDate": "2017-02-22T23:03:13Z",
"priceUnit": "hour",
"price": 0,
"cost": 0,
"zones": [
{
"computeServers": [
{
"servers": [
{
"usages": [
]
}
]
}
],
"instances": [
{
"instances": [
{
"containers": {
"usages": [
]
}
}
]
}
]
}
]
}
}
Retrieves billing information for the requesting user’s account.
HTTP Request
GET https://api.gomorpheus.com/api/billing/account
Query Parameters
Parameter | Default | Description |
---|---|---|
startDate | Beginning of the current month | |
endDate | Now | |
includeUsages | true | Optional ability to suppress the usage records |
maxUsages | null | Optional ability to limit the usages returned |
offsetUsages | null | Optional ability to offset the usages returned, for use with maxUsages to paginate |
Billing For a Specific Tenant
Will retrieve billing information for a specific tenant, if it is the current account or a sub account of the requesting user’s account.
curl "$MORPHEUS_API_URL/api/billing/account/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"success": true,
"billingInfo": {
"accountId": 1,
"name": "morpheus",
"startDate": "2017-02-01T07:00:00Z",
"endDate": "2017-02-22T23:03:13Z",
"priceUnit": "hour",
"price": 0,
"cost": 0,
"zones": [
{
"computeServers": [
{
"servers": [
{
"usages": [
]
}
]
}
],
"instances": [
{
"instances": [
{
"containers": {
"usages": [
]
}
}
]
}
]
}
]
}
}
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/billing/account/:id
Query Parameters
Parameter | Default | Description |
---|---|---|
startDate | Beginning of the current month | |
endDate | Now | |
includeUsages | true | Optional ability to suppress the usage records |
maxUsages | null | Optional ability to limit the usages returned |
offsetUsages | null | Optional ability to offset the usages returned, for use with maxUsages to paginate |
Billing For All Zones
curl "$MORPHEUS_API_URL/api/billing/zones" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"success": true,
"billingInfo": {
"startDate": "2017-02-01T07:00:00Z",
"endDate": "2017-02-22T23:03:13Z",
"priceUnit": "hour",
"price": 0,
"cost": 0,
"zones": [
{
"computeServers": [
{
"servers": [
{
"usages": [
]
}
]
}
],
"instances": [
{
"instances": [
{
"containers": {
"usages": [
]
}
}
]
}
]
}
]
}
}
Retrieves billing information for all zones on the requestor’s account.
HTTP Request
GET https://api.gomorpheus.com/api/billing/zones
Query Parameters
Parameter | Default | Description |
---|---|---|
startDate | Beginning of the current month | |
endDate | Now | |
includeUsages | true | Optional ability to suppress the usage records |
maxUsages | null | Optional ability to limit the usages returned |
offsetUsages | null | Optional ability to offset the usages returned, for use with maxUsages to paginate |
includeTenants | false | Optional ability to include all subtenant billing information when calling from a master tenant user |
accountId | Optional ability to scope billing information to a subtenant when calling from a master tenant user. When specified with “includeTenants=true” accountId is ignored |
Billing For a Specific Zone
curl "$MORPHEUS_API_URL/api/billing/zones/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"success": true,
"billingInfo": {
"zoneName": "",
"zoneId": 1,
"startDate": "2017-01-01T00:00:00Z",
"endDate": "2017-01-31T23:59:59Z",
"priceUnit": "hour",
"computeServers": {
"servers": [
{
"usages": [
]
}
]
},
"instances": {
"instances": [
{
"containers": [
{
"usages": [
{
"applicablePrices": [
]
}
]
}
]
}
]
}
}
}
Retrieves billing information for a specific zone in the requestor’s account.
HTTP Request
GET https://api.gomorpheus.com/api/billing/zones/:id
Query Parameters
Parameter | Default | Description |
---|---|---|
startDate | Beginning of the current month | |
endDate | Now | |
includeUsages | true | Optional ability to suppress the usage records |
maxUsages | null | Optional ability to limit the usages returned |
offsetUsages | null | Optional ability to offset the usages returned, for use with maxUsages to paginate |
includeTenants | false | Optional ability to include all subtenant billing information when calling from a master tenant user |
accountId | Optional ability to scope billing information to a subtenant when calling from a master tenant user. When specified with “includeTenants=true” accountId is ignored |
Billing For All Servers
curl "$MORPHEUS_API_URL/api/billing/servers" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"success": true,
"billingInfo": {
"price": 0,
"cost": 0,
"startDate": "2017-03-01T07:00:00Z",
"endDate": "2017-03-09T22:03:28Z",
"servers": [
{
"refType": "computeServer",
"refId": 1,
"startDate": "2017-01-01T00:00:00Z",
"endDate": "2017-01-31T23:59:59Z",
"cost": 0,
"price": 0,
"usages": [
],
"numUnits": 0,
"unit": "hour",
"name": "name"
}
]
}
}
Retrieves billing information for all servers (container hosts) on the requestor’s account.
HTTP Request
GET https://api.gomorpheus.com/api/billing/servers
Query Parameters
Parameter | Default | Description |
---|---|---|
startDate | Beginning of the current month | |
endDate | Now | |
includeUsages | true | Optional ability to suppress the usage records |
maxUsages | null | Optional ability to limit the usages returned |
offsetUsages | null | Optional ability to offset the usages returned, for use with maxUsages to paginate |
includeTenants | false | Optional ability to include all subtenant billing information when calling from a master tenant user |
accountId | Optional ability to scope billing information to a subtenant when calling from a master tenant user. When specified with “includeTenants=true” accountId is ignored |
Billing For a Specific Server
curl "$MORPHEUS_API_URL/api/billing/servers/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"success": true,
"billingInfo": {
"refType": "computeServer",
"refId": 1,
"startDate": "2017-01-01T00:00:00Z",
"endDate": "2017-01-31T23:59:59Z",
"cost": 0,
"price": 0,
"usages": [
],
"numUnits": 0,
"unit": "hour",
"name": "name"
}
}
Retrieves billing information for a specific server (container host) in the requestor’s account.
HTTP Request
GET https://api.gomorpheus.com/api/billing/servers/:id
Query Parameters
Parameter | Default | Description |
---|---|---|
startDate | Beginning of the current month | |
endDate | Now | |
includeUsages | true | Optional ability to suppress the usage records |
maxUsages | null | Optional ability to limit the usages returned |
offsetUsages | null | Optional ability to offset the usages returned, for use with maxUsages to paginate |
includeTenants | false | Optional ability to include all subtenant billing information when calling from a master tenant user |
accountId | Optional ability to scope billing information to a subtenant when calling from a master tenant user. When specified with “includeTenants=true” accountId is ignored |
Billing For All Instances
curl "$MORPHEUS_API_URL/api/billing/instances" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"success": true,
"billingInfo": {
"price": 0.0,
"cost": 0.0,
"startDate": "2017-01-01T00:00:00Z",
"endDate": "2017-01-31T23:59:59Z",
"instances": [
{
"containers": [
{
"usages": [
],
"numUnits": 0.0,
"unit": "hour",
"name": "name"
}
]
}
]
}
}
Retrieves billing information for all instances on the requestor’s account.
HTTP Request
GET https://api.gomorpheus.com/api/billing/instances
Query Parameters
Parameter | Default | Description |
---|---|---|
startDate | Beginning of the current month | |
endDate | Now | |
includeUsages | true | Optional ability to suppress the usage records |
maxUsages | null | Optional ability to limit the usages returned |
offsetUsages | null | Optional ability to offset the usages returned, for use with maxUsages to paginate |
includeTenants | false | Optional ability to include all subtenant billing information when calling from a master tenant user |
accountId | Optional ability to scope billing information to a subtenant when calling from a master tenant user. When specified with “includeTenants=true” accountId is ignored |
Billing For a Specific Instance
curl "$MORPHEUS_API_URL/api/billing/instances/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"success": true,
"billingInfo": {
"instanceId": 11,
"startDate": "2017-01-01T00:00:00Z",
"endDate": "2017-01-31T23:59:59Z",
"name": "name",
"price": 0,
"cost": 0,
"containers": [
{
"usages": [
{
"applicablePrices": [
]
}
],
"numUnits": 0.0,
"unit": "hour",
"name": "name"
}
]
}
}
Retrieves billing information for a specific server in the requestor’s account.
HTTP Request
GET https://api.gomorpheus.com/api/billing/instances/:id
Query Parameters
Parameter | Default | Description |
---|---|---|
startDate | Beginning of the current month | |
endDate | Now | |
includeUsages | true | Optional ability to suppress the usage records |
maxUsages | null | Optional ability to limit the usages returned |
offsetUsages | null | Optional ability to offset the usages returned, for use with maxUsages to paginate |
includeTenants | false | Optional ability to include all subtenant billing information when calling from a master tenant user |
accountId | Optional ability to scope billing information to a subtenant when calling from a master tenant user. When specified with “includeTenants=true” accountId is ignored |
Invoices
Provides API interfaces for viewing account invoices.
Get All Invoices
curl "$MORPHEUS_API_URL/api/invoices" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"invoices": [
{
"id": 11868,
"account": {
"id": 1,
"name": "root"
},
"group": {
"id": 1,
"name": "lonestar"
},
"cloud": {
"id": 39,
"name": "qa-amazon"
},
"instance": {
"id": 331,
"name": "nginx21"
},
"server": null,
"cluster": null,
"user": {
"id": 1,
"name": "admin"
},
"plan": {
"id": 1,
"name": "Amazon T2 Nano - 1 Core, 0.5GB Memory"
},
"tags": [
{
"id": 714462,
"name": "agency",
"value": "Lonestar"
},
{
"id": 714460,
"name": "hello",
"value": "world"
}
],
"project": {
"id": 2,
"name": "test",
"tags": {
"agency": "Lonestar"
}
},
"refType": "Instance",
"refId": 331,
"refName": "nginx21",
"refCategory": "vm",
"resourceId": null,
"resourceUuid": null,
"resourceType": null,
"resourceName": null,
"resourceExternalId": null,
"resourceInternalId": null,
"interval": "month",
"period": "202005",
"estimate": false,
"active": true,
"startDate": "2020-05-01T04:00:00+0000",
"endDate": "2020-06-01T03:59:59+0000",
"refStart": "2020-05-01T04:00:00+0000",
"refEnd": "2020-06-01T03:59:59+0000",
"estimatedComputePrice": 0.0,
"estimatedComputeCost": 0.0,
"estimatedMemoryPrice": 0.0,
"estimatedMemoryCost": 0.0,
"estimatedStoragePrice": 0.0,
"estimatedStorageCost": 0.0,
"estimatedNetworkPrice": 0.0,
"estimatedNetworkCost": 0.0,
"estimatedLicensePrice": 0.0,
"estimatedLicenseCost": 0.0,
"estimatedExtraPrice": 0.0,
"estimatedExtraCost": 0.0,
"estimatedTotalPrice": 6.250800024,
"estimatedTotalCost": 6.250800024,
"estimatedRunningPrice": 1.5038869430406268,
"estimatedRunningCost": 1.5038869430406268,
"invoiceComputePrice": 0.0,
"invoiceComputeCost": 0.0,
"invoiceMemoryPrice": 0.0,
"invoiceMemoryCost": 0.0,
"invoiceStoragePrice": 0.0,
"invoiceStorageCost": 0.0,
"invoiceNetworkPrice": 0.0,
"invoiceNetworkCost": 0.0,
"invoiceLicensePrice": 0.0,
"invoiceLicenseCost": 0.0,
"invoiceExtraPrice": 0.0,
"invoiceExtraCost": 0.0,
"invoiceTotalPrice": 0.0,
"invoiceTotalCost": 0.0,
"invoiceRunningPrice": 0.0,
"invoiceRunningCost": 0.0,
"actualComputePrice": 0.1709403426,
"actualComputeCost": 0.1709403426,
"actualMemoryPrice": 0.0,
"actualMemoryCost": 0.0,
"actualStoragePrice": 0.0,
"actualStorageCost": 0.0,
"actualNetworkPrice": 0.0,
"actualNetworkCost": 0.0,
"actualLicensePrice": 0.0,
"actualLicenseCost": 0.0,
"actualExtraPrice": 0.0,
"actualExtraCost": 0.0,
"actualTotalPrice": 0.7105014791842815,
"actualTotalCost": 0.7105014791842815,
"actualRunningPrice": 0.1709403426,
"actualRunningCost": 0.1709403426,
"computePrice": 0.1709403426,
"computeCost": 0.1709403426,
"memoryPrice": 0.0,
"memoryCost": 0.0,
"storagePrice": 0.0,
"storageCost": 0.0,
"networkPrice": 0.0,
"networkCost": 0.0,
"licensePrice": 0.0,
"licenseCost": 0.0,
"extraPrice": 0.0,
"extraCost": 0.0,
"totalPrice": 0.7105014791842815,
"totalCost": 0.7105014791842815,
"runningPrice": 0.1709403426,
"runningCost": 0.1709403426,
"costType": "actual",
"offTime": 0,
"powerState": "on",
"powerDate": "2020-05-01T04:00:00+0000",
"runningMultiplier": 0.2405911143,
"lastCostDate": "2020-05-08T14:59:59+0000",
"lastActualDate": "2020-05-08T14:59:59+0000",
"dateCreated": "2020-05-01T15:59:49+0000",
"lastUpdated": "2020-05-08T15:00:08+0000",
"lineItems": [
]
}
],
"meta": {
"size": 25,
"total": 35021,
"offset": 0,
"max": 25
}
}
This endpoint retrieves a list of invoices for the specified parameters.
HTTP Request
GET https://api.gomorpheus.com/api/invoices
Query Parameters
Parameter | Default | Description |
---|---|---|
max | 25 | Max number of results to return |
offset | 0 | Offset of records you want to load |
sort | startDate desc | Sort order |
direction | asc | Sort direction, use ‘desc’ to reverse sort |
phrase | If specified will return a partial match on refName | |
name | If specified will return an exact match on refName | |
startDate | Only return records with a startDate greater than or equal to the specified date. Format is YYYY-MM-DD. | |
endDate | Only return records with an endDate less than or equal to the specified date. Format is YYYY-MM-DD. | |
period | Only return records for period that matches with the specified value. This is an alternative to using startDate/endDate. Format is YYYY or YYYYMM. | |
refType | If specified will return an exact match on refType. eg. ComputeSite (Group), ComputeZone (Cloud), ComputeServer (Host), Instance, Container, User. | |
refId | If specified will return an exact match on refId | |
refStatus | If specified, will filter on the associated StorageVolume status. eg. provisioned or unattached . This is only applicable when refType=StorageVolume . |
|
zoneId | If specified will return an exact match on zone (cloud) ID | |
siteId | If specified will return an exact match on site (group) ID | |
instanceId | If specified will return an exact match on instance ID | |
containerId | If specified will return an exact match on container ID | |
serverId | If specified will return an exact match on server (host) ID | |
userId | If specified will return an exact match on user ID | |
projectId | If specified will return an exact match on project ID | |
active | If specified will return an exact match on active flag. | |
accountId | (own account) | Allows master tenant users to view invoices for another tenant. |
rawData | false | Pass true to include the cost data from the cloud provider’s API in a property called rawData . |
includeTotals | false | Pass true to include the summed totals (cost/price values) for all the invoices found in the query. The returned property is called invoiceTotals . |
tags | Filter by tags (metadata). This allows filtering by a tag name and value(s) like this tags.env=qa or tags.env=qa&tags.env=test which matches both: env=qa or env=test. |
Get a Specific Invoice
curl "$MORPHEUS_API_URL/api/invoices/11868" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"invoice": {
"id": 11868,
"account": {
"id": 1,
"name": "root"
},
"group": {
"id": 1,
"name": "lonestar"
},
"cloud": {
"id": 39,
"name": "qa-amazon"
},
"instance": {
"id": 331,
"name": "nginx21"
},
"server": null,
"cluster": null,
"user": {
"id": 1,
"name": "admin"
},
"plan": {
"id": 1,
"name": "Amazon T2 Nano - 1 Core, 0.5GB Memory"
},
"tags": [
{
"id": 714462,
"name": "agency",
"value": "Lonestar"
},
{
"id": 714460,
"name": "hello",
"value": "world"
}
],
"project": {
"id": 2,
"name": "test",
"tags": {
"agency": "Lonestar"
}
},
"refType": "Instance",
"refId": 331,
"refName": "nginx21",
"refCategory": "vm",
"resourceId": null,
"resourceUuid": null,
"resourceType": null,
"resourceName": null,
"resourceExternalId": null,
"resourceInternalId": null,
"interval": "month",
"period": "202005",
"estimate": false,
"active": true,
"startDate": "2020-05-01T04:00:00+0000",
"endDate": "2020-06-01T03:59:59+0000",
"refStart": "2020-05-01T04:00:00+0000",
"refEnd": "2020-06-01T03:59:59+0000",
"estimatedComputePrice": 0.0,
"estimatedComputeCost": 0.0,
"estimatedMemoryPrice": 0.0,
"estimatedMemoryCost": 0.0,
"estimatedStoragePrice": 0.0,
"estimatedStorageCost": 0.0,
"estimatedNetworkPrice": 0.0,
"estimatedNetworkCost": 0.0,
"estimatedLicensePrice": 0.0,
"estimatedLicenseCost": 0.0,
"estimatedExtraPrice": 0.0,
"estimatedExtraCost": 0.0,
"estimatedTotalPrice": 6.250800024,
"estimatedTotalCost": 6.250800024,
"estimatedRunningPrice": 1.5038869430406268,
"estimatedRunningCost": 1.5038869430406268,
"invoiceComputePrice": 0.0,
"invoiceComputeCost": 0.0,
"invoiceMemoryPrice": 0.0,
"invoiceMemoryCost": 0.0,
"invoiceStoragePrice": 0.0,
"invoiceStorageCost": 0.0,
"invoiceNetworkPrice": 0.0,
"invoiceNetworkCost": 0.0,
"invoiceLicensePrice": 0.0,
"invoiceLicenseCost": 0.0,
"invoiceExtraPrice": 0.0,
"invoiceExtraCost": 0.0,
"invoiceTotalPrice": 0.0,
"invoiceTotalCost": 0.0,
"invoiceRunningPrice": 0.0,
"invoiceRunningCost": 0.0,
"actualComputePrice": 0.1709403426,
"actualComputeCost": 0.1709403426,
"actualMemoryPrice": 0.0,
"actualMemoryCost": 0.0,
"actualStoragePrice": 0.0,
"actualStorageCost": 0.0,
"actualNetworkPrice": 0.0,
"actualNetworkCost": 0.0,
"actualLicensePrice": 0.0,
"actualLicenseCost": 0.0,
"actualExtraPrice": 0.0,
"actualExtraCost": 0.0,
"actualTotalPrice": 0.7105014791842815,
"actualTotalCost": 0.7105014791842815,
"actualRunningPrice": 0.1709403426,
"actualRunningCost": 0.1709403426,
"computePrice": 0.1709403426,
"computeCost": 0.1709403426,
"memoryPrice": 0.0,
"memoryCost": 0.0,
"storagePrice": 0.0,
"storageCost": 0.0,
"networkPrice": 0.0,
"networkCost": 0.0,
"licensePrice": 0.0,
"licenseCost": 0.0,
"extraPrice": 0.0,
"extraCost": 0.0,
"totalPrice": 0.7105014791842815,
"totalCost": 0.7105014791842815,
"runningPrice": 0.1709403426,
"runningCost": 0.1709403426,
"costType": "actual",
"offTime": 0,
"powerState": "on",
"powerDate": "2020-05-01T04:00:00+0000",
"runningMultiplier": 0.2405911143,
"lastCostDate": "2020-05-08T14:59:59+0000",
"lastActualDate": "2020-05-08T14:59:59+0000",
"dateCreated": "2020-05-01T15:59:49+0000",
"lastUpdated": "2020-05-08T15:00:08+0000",
"lineItems": [
]
}
}
This endpoint retrieves a specific invoice.
HTTP Request
GET https://api.gomorpheus.com/api/invoices/:id
URL Parameters
Parameter | Description |
---|---|
id | ID of the invoice |
Query Parameters
Parameter | Default | Description |
---|---|---|
rawData | false | Pass true to include the cost data from the cloud provider’s API in a property called rawData . |
Update Invoice Tags
curl -XPUT "$MORPHEUS_API_URL/api/invoices/:id" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "invoice": {
"addTags": [
{"name": "hello", "value": "world"}
],
"removeTags": [
{"name": "oldTag"}
]
}}'
The above command returns a similar JSON structure when submitting a GET request for a specific invoice
This endpoint allows updating the tags for a specific invoice. Invoice tags are automatically set to match the tags of the associated resource (ComputeServer/Instance/Container).
HTTP Request
PUT https://api.gomorpheus.com/api/invoices/:id
JSON Invoice Parameters
Parameter | Default | Description |
---|---|---|
tags | Metadata tags, Array of objects having a name and value, this adds or updates the specified tags and removes any tags not specified. | |
addTags | Add or update value of Metadata tags, Array of objects having a name and value | |
removeTags | Remove Metadata tags, Array of objects having a name and an optional value. If value is passed, it must match to be removed. |
Get All Invoice Line Items
curl "$MORPHEUS_API_URL/api/invoice-line-items" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"lineItems": [
{
"id": 3247,
"invoiceId": 12347,
"refType": "AccountResource",
"refId": 3,
"refName": "ocid1.instance.oc1.iad.abuwcljsdtocgl7wumoxflvd7725dobh3zk2s3rdmtnp5ixt2x7nc3awllda",
"refCategory": "invoice",
"startDate": "2020-05-09T22:00:00+0000",
"endDate": "2020-05-09T23:00:00+0000",
"itemId": "zmtWmBaN56GdFZq3ZeMhaTwKAXcECByQNvnlRA8yfsws/41naer2wamK1pC4gGVoxDjEHXVuDi3BHgE1epCBn5P5XcuFSmUd",
"itemType": null,
"itemName": "ocid1.instance.oc1.iad.abuwcljsdtocgl7wumoxflvd7725dobh3zk2s3rdmtnp5ixt2x7nc3awllda",
"itemDescription": null,
"productId": null,
"productCode": "B88514",
"productName": null,
"itemSeller": null,
"itemAction": null,
"externalId": "zmtWmBaN56GdFZq3ZeMhaTwKAXcECByQNvnlRA8yfsws/41naer2wamK1pC4gGVoxDjEHXVuDi3BHgE1epCBn5P5XcuFSmUd",
"rateId": null,
"rateClass": null,
"rateUnit": "0.0638",
"rateTerm": null,
"usageType": "Virtual Machine Standard - X7",
"usageCategory": "compute",
"itemUsage": 1.0,
"itemRate": 0.0,
"itemCost": 0.0638,
"itemPrice": 0.0638,
"itemTax": 0.0,
"itemTerm": null,
"taxType": null,
"dateCreated": "2020-05-12T02:29:54+0000",
"lastUpdated": "2020-05-12T02:29:54+0000"
},
{
"id": 3246,
"invoiceId": 12431,
"refType": "AccountResource",
"refId": 2139,
"refName": "ow-oraclecloud-1",
"refCategory": "invoice",
"startDate": "2020-05-09T21:00:00+0000",
"endDate": "2020-05-09T22:00:00+0000",
"itemId": "zmtWmBaN56GdFZq3ZeMhaTwKAXcECByQNvnlRA8yfsws/41naer2wamK1pC4gGVoxDjEHXVuDi39cmcwss32ZJP5XcuFSmUd",
"itemType": null,
"itemName": "ow-oraclecloud-1",
"itemDescription": null,
"productId": null,
"productCode": "B91962",
"productName": null,
"itemSeller": null,
"itemAction": null,
"externalId": "zmtWmBaN56GdFZq3ZeMhaTwKAXcECByQNvnlRA8yfsws/41naer2wamK1pC4gGVoxDjEHXVuDi39cmcwss32ZJP5XcuFSmUd",
"rateId": null,
"rateClass": null,
"rateUnit": "0.0017",
"rateTerm": null,
"usageType": "Block Volume - Performance Units",
"usageCategory": "storage",
"itemUsage": 0.672043008681,
"itemRate": 0.0,
"itemCost": 0.001142473117,
"itemPrice": 0.001142473117,
"itemTax": 0.0,
"itemTerm": null,
"taxType": null,
"dateCreated": "2020-05-11T08:47:06+0000",
"lastUpdated": "2020-05-11T08:47:06+0000"
}
],
"meta": {
"size": 2,
"total": 3269,
"offset": 22,
"max": 25
}
}
This endpoint retrieves all invoice line items for the specified parameters.
HTTP Request
GET https://api.gomorpheus.com/api/invoice-line-items
Query Parameters
Parameter | Default | Description |
---|---|---|
max | 25 | Max number of results to return |
offset | 0 | Offset of records you want to load |
sort | startDate desc | Sort order |
direction | asc | Sort direction, use 'desc’ to reverse sort |
phrase | If specified will return a partial match on refName | |
name | If specified will return an exact match on refName | |
startDate | Only return records with a startDate greater than or equal to the specified date. Format is YYYY-MM-DD. | |
endDate | Only return records with an endDate less than or equal to the specified date. Format is YYYY-MM-DD. | |
period | Only return records for period that matches with the specified value. This is an alternative to using startDate/endDate. Format is YYYY or YYYYMM. | |
refType | If specified will return an exact match on refType. eg. ComputeSite (Group), ComputeZone (Cloud), ComputeServer (Host), Instance, Container, User. | |
refId | If specified will return an exact match on refId | |
zoneId | If specified will return an exact match on zone (cloud) ID | |
siteId | If specified will return an exact match on site (group) ID | |
instanceId | If specified will return an exact match on instance ID | |
containerId | If specified will return an exact match on container ID | |
serverId | If specified will return an exact match on server (host) ID | |
userId | If specified will return an exact match on user ID | |
projectId | If specified will return an exact match on project ID | |
active | If specified will return an exact match on active flag. | |
includeTotals | false | If true, invoiceTotals is returned containing sums of all the cost and prices for all the invoices found. |
accountId | (own account) | Allows master tenant users to view invoices for another tenant. |
rawData | false | Pass true to include the cost data from the cloud provider’s API in a property called rawData . |
includeTotals | false | Pass true to include the summed totals (cost/price values) for all the invoices found in the query. The returned property is called lineItemTotals . |
Get a Specific Invoice Line Item
curl "$MORPHEUS_API_URL/api/invoice-line-items/678" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"lineItem": {
"id": 3246,
"invoiceId": 12431,
"refType": "AccountResource",
"refId": 2139,
"refName": "ow-oraclecloud-1",
"refCategory": "invoice",
"startDate": "2020-05-09T21:00:00+0000",
"endDate": "2020-05-09T22:00:00+0000",
"itemId": "zmtWmBaN56GdFZq3ZeMhaTwKAXcECByQNvnlRA8yfsws/41naer2wamK1pC4gGVoxDjEHXVuDi39cmcwss32ZJP5XcuFSmUd",
"itemType": null,
"itemName": "ow-oraclecloud-1",
"itemDescription": null,
"productId": null,
"productCode": "B91962",
"productName": null,
"itemSeller": null,
"itemAction": null,
"externalId": "zmtWmBaN56GdFZq3ZeMhaTwKAXcECByQNvnlRA8yfsws/41naer2wamK1pC4gGVoxDjEHXVuDi39cmcwss32ZJP5XcuFSmUd",
"rateId": null,
"rateClass": null,
"rateUnit": "0.0017",
"rateTerm": null,
"usageType": "Block Volume - Performance Units",
"usageCategory": "storage",
"itemUsage": 0.672043008681,
"itemRate": 0.0,
"itemCost": 0.001142473117,
"itemPrice": 0.001142473117,
"itemTax": 0.0,
"itemTerm": null,
"taxType": null,
"dateCreated": "2020-05-11T08:47:06+0000",
"lastUpdated": "2020-05-11T08:47:06+0000"
}
}
This endpoint retrieves a specific invoice.
HTTP Request
GET https://api.gomorpheus.com/api/invoice-line-items/:id
URL Parameters
Parameter | Description |
---|---|
id | ID of the invoice line item |
Query Parameters
Parameter | Default | Description |
---|---|---|
rawData | false | Pass true to include the cost data from the cloud provider’s API in a property called rawData . |
Projects
Morpheus provides a database for keeping track of Projects in the system. Projects can be used to associate resources together and assign common metadata tags to their invoices.
Get All Projects
curl "$MORPHEUS_API_URL/api/projects"
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"projects": [
{
"id": 1,
"name": "test",
"description": "api test",
"owner": {
"id": 1,
"username": "admin"
},
"tags": [
{
"id": 18028,
"name": "foo",
"value": "bar"
}
],
"instances": [
{
"id": 303,
"name": "ubuntutest"
}
],
"servers": [
],
"clouds": [
{
"id": 39,
"name": "qa-amazon"
}
],
"dateCreated": "2020-05-05T17:11:16+0000",
"lastUpdated": "2020-05-06T16:06:31+0000"
},
{
"id": 2,
"name": "uno",
"description": "a test project about pizza",
"owner": {
"id": 1,
"username": "admin"
},
"tags": [
{
"id": 18115,
"name": "pizzeria",
"value": "uno"
},
{
"id": 18117,
"name": "planet",
"value": "saturn"
},
{
"id": 18116,
"name": "taste",
"value": "delicious"
}
],
"instances": [
{
"id": 344,
"name": "nginx21"
}
],
"servers": [
],
"clouds": [
{
"id": 32,
"name": "qa-google"
}
],
"dateCreated": "2020-05-07T03:00:02+0000",
"lastUpdated": "2020-05-07T03:10:51+0000"
}
],
"meta": {
"size": 2,
"total": 2,
"offset": 0,
"max": 25
}
}
This endpoint retrieves all projects associated with the account.
HTTP Request
GET https://api.gomorpheus.com/api/projects
Query Parameters
Parameter | Default | Description |
---|---|---|
phrase | Filter on partial match of name or description | |
name | Filter on exact match of name | |
instanceId | Filter by associated Instance | |
serverId | Filter by associated Server | |
cloudId | Filter by associated Cloud | |
resourceId | Filter by associated AccountResource(s). These are discovered AccountResource records that do not belong to known instances or servers. | |
ownerId | Filter by owner | |
id | Filter by Project id(s) |
Get a Specific Project
curl "$MORPHEUS_API_URL/api/projects/2" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"project": {
"id": 19,
"name": "uno",
"description": "a test project about pizza",
"owner": {
"id": 1,
"username": "james"
},
"tags": [
{
"id": 18115,
"name": "pizzeria",
"value": "uno"
},
{
"id": 18117,
"name": "planet",
"value": "saturn"
},
{
"id": 18116,
"name": "taste",
"value": "delicious"
}
],
"instances": [
{
"id": 344,
"name": "nginx21"
}
],
"servers": [
],
"clouds": [
{
"id": 32,
"name": "qa-google"
}
],
"dateCreated": "2020-05-07T03:00:02+0000",
"lastUpdated": "2020-05-07T03:10:51+0000"
}
}
This endpoint retrieves a specific project.
HTTP Request
GET https://api.gomorpheus.com/api/projects/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the project |
Create a Project
curl -XPOST "$MORPHEUS_API_URL/api/projects" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"project":{
"name": "Test Project",
"description": "a test project",
"tags": {"hello":"world"},
"instances":[
{"id":1}, {"id":2}, {"id":3}
]
}}'
The above command returns JSON structured like getting a single project:
Create a new project.
HTTP Request
POST https://api.gomorpheus.com/api/projects
JSON Parameters
Parameter | Default | Description |
---|---|---|
name | A unique name for your project | |
description | Description | |
tags | Metadata tags, Array of objects having a name and value | |
instances | Instances, Array of objects having an id | |
servers | Servers, Array of objects having an id | |
clouds | Clouds, Array of objects having an id | |
resources | Resources, Array of objects having an id. These are discovered AccountResource records that do not belong to known instances or servers. |
Update a Project
curl -XPUT "$MORPHEUS_API_URL/api/projects/:id" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"project":{
"addInstances":[
{"id":4}, {"id":5}, {"id":6}
]
}}'
The above command returns JSON structured like getting a single project:
Update an existing project.
HTTP Request
PUT https://api.gomorpheus.com/api/projects/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the project |
JSON Parameters
Parameter | Default | Description |
---|---|---|
name | A unique name for your project | |
description | Description | |
tags | Metadata tags, Array of objects having a name and value | |
addTags | Add or update value of Metadata tags, Array of objects having a name and value | |
removeTags | Remove Metadata tags, Array of objects having a name and an optional value. If value is passed, it must match to be removed. | |
instances | Instances, Array of objects having an id | |
servers | Servers, Array of objects having an id | |
clouds | Clouds, Array of objects having an id | |
addInstances | Add Instances to the project, Array of objects having an id | |
removeInstances | Remove Instances from the project, Array of objects having an id | |
addServers | Add Servers to the project, Array of objects having an id | |
removeServers | Remove Servers to remove from the project, Array of objects having an id | |
addClouds | Add Clouds to the project, Array of objects having an id | |
removeClouds | Remove Clouds from the project, Array of objects having an id | |
resources | Resources, Array of objects having an id. These are discovered AccountResource records that do not belong to known instances or servers. | |
addResources | Add Resources to the project, Array of objects having an id | |
removeResources | Remove Resources from the project, Array of objects having an id |
Delete a Project
curl -XDELETE "$MORPHEUS_API_URL/api/projects/:id" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON Structured like this:
{
"success": true
}
Delete a project from the system and make it no longer usable.
HTTP Request
DELETE https://api.gomorpheus.com/api/projects/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the project |
History
Provides API interfaces for viewing the process history for instances.
Get All Processes
curl "$MORPHEUS_API_URL/api/processes" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"processes": [
{
"id": 250,
"accountId": 1,
"uniqueId": "cebc47ec-cb2f-417a-886e-dd60cf81db26",
"processType": {
"code": "provision",
"name": "provision"
},
"description": null,
"subType": null,
"subId": null,
"zoneId": 34,
"integrationId": null,
"instanceId": 238,
"containerId": 240,
"serverId": 601,
"containerName": "apachetest",
"displayName": "apachetest",
"timerCategory": "vmware",
"timerSubCategory": "28",
"status": "failed",
"reason": null,
"percent": 100.0,
"statusEta": 348246,
"message": null,
"output": null,
"error": null,
"startDate": "2018-09-28T19:10:56+0000",
"endDate": "2018-09-28T20:21:49+0000",
"duration": 4253127,
"dateCreated": "2018-09-28T19:10:56+0000",
"lastUpdated": "2018-09-28T20:21:49+0000",
"createdBy": {
"username": "admin",
"displayName": "Admin"
},
"updatedBy": {
"username": "admin",
"displayName": "Admin"
},
"events": [
]
}
],
"meta": {
"size": 1,
"total": 1,
"offset": 0,
"max": 25
}
}
This endpoint retrieves all processes.
HTTP Request
GET https://api.gomorpheus.com/api/processes
Query Parameters
Parameter | Default | Description |
---|---|---|
phrase | If specified will return a partial match on displayName, message or output | |
instanceId | Filter by instance id(s) | |
containerId | Filter by container id(s) | |
serverId | Filter by server id(s) | |
zoneId | Filter by zone id(s) | |
appId | Filter by app id(s) |
Get a Specific Process
curl "$MORPHEUS_API_URL/api/processes/250" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"process": {
"id": 250,
"accountId": 1,
"uniqueId": "cebc47ec-cb2f-417a-886e-dd60cf81db26",
"processType": {
"code": "provision",
"name": "provision"
},
"description": null,
"subType": null,
"subId": null,
"zoneId": 34,
"integrationId": null,
"instanceId": 238,
"containerId": 240,
"serverId": 601,
"containerName": "apachetest",
"displayName": "apachetest",
"timerCategory": "vmware",
"timerSubCategory": "28",
"status": "failed",
"reason": null,
"percent": 100.0,
"statusEta": 348246,
"message": null,
"output": null,
"error": null,
"startDate": "2018-09-28T19:10:56+0000",
"endDate": "2018-09-28T20:21:49+0000",
"duration": 4253127,
"dateCreated": "2018-09-28T19:10:56+0000",
"lastUpdated": "2018-09-28T20:21:49+0000",
"createdBy": {
"username": "admin",
"displayName": "Admin"
},
"updatedBy": {
"username": "admin",
"displayName": "Admin"
},
"events": [
{
"id": 940,
"processId": 250,
"accountId": 1,
"uniqueId": "54bf6265-1e86-45b4-b1a7-d4b198b13c45",
"processType": {
"code": "provisionResources",
"name": "prepare resources"
},
"description": null,
"refType": "container",
"refId": 240,
"subType": null,
"subId": null,
"zoneId": 34,
"integrationId": null,
"instanceId": 238,
"containerId": 240,
"serverId": 601,
"containerName": "apachetest",
"displayName": "apachetest",
"status": "complete",
"reason": null,
"percent": 100.0,
"statusEta": 348246,
"message": null,
"output": null,
"error": null,
"startDate": "2018-09-28T19:10:56+0000",
"endDate": "2018-09-28T19:10:57+0000",
"duration": 921,
"dateCreated": "2018-09-28T19:10:56+0000",
"lastUpdated": "2018-09-28T19:10:57+0000",
"createdBy": {
"username": "admin",
"displayName": "Admin"
},
"updatedBy": {
"username": "admin",
"displayName": "Admin"
}
},
{
"id": 941,
"processId": 250,
"accountId": 1,
"uniqueId": "9a9791b7-0091-4ba7-be4d-e1586be3078c",
"processType": {
"code": "provisionImage",
"name": "prepare image"
},
"description": null,
"refType": "container",
"refId": 240,
"subType": null,
"subId": null,
"zoneId": 34,
"integrationId": null,
"instanceId": 238,
"containerId": 240,
"serverId": 601,
"containerName": "apachetest",
"displayName": "apachetest",
"status": "complete",
"reason": null,
"percent": 100.0,
"statusEta": 348246,
"message": null,
"output": null,
"error": null,
"startDate": "2018-09-28T19:10:57+0000",
"endDate": "2018-09-28T19:11:01+0000",
"duration": 3645,
"dateCreated": "2018-09-28T19:10:57+0000",
"lastUpdated": "2018-09-28T19:11:01+0000",
"createdBy": {
"username": "admin",
"displayName": "Admin"
},
"updatedBy": {
"username": "admin",
"displayName": "Admin"
}
},
{
"id": 942,
"processId": 250,
"accountId": 1,
"uniqueId": "f1905796-9387-4983-ae0d-0fee5bb81f56",
"processType": {
"code": "provisionConfig",
"name": "configure instance"
},
"description": null,
"refType": "container",
"refId": 240,
"subType": null,
"subId": null,
"zoneId": 34,
"integrationId": null,
"instanceId": 238,
"containerId": 240,
"serverId": 601,
"containerName": "apachetest",
"displayName": "apachetest",
"status": "complete",
"reason": null,
"percent": 100.0,
"statusEta": 348246,
"message": null,
"output": null,
"error": null,
"startDate": "2018-09-28T19:11:01+0000",
"endDate": "2018-09-28T19:11:01+0000",
"duration": 28,
"dateCreated": "2018-09-28T19:11:01+0000",
"lastUpdated": "2018-09-28T19:11:01+0000",
"createdBy": {
"username": "admin",
"displayName": "Admin"
},
"updatedBy": {
"username": "admin",
"displayName": "Admin"
}
},
{
"id": 943,
"processId": 250,
"accountId": 1,
"uniqueId": "599a0c2d-491c-4178-8b86-55b6d019d48c",
"processType": {
"code": "provisionDeploy",
"name": "deploy instance"
},
"description": null,
"refType": "container",
"refId": 240,
"subType": null,
"subId": null,
"zoneId": 34,
"integrationId": null,
"instanceId": 238,
"containerId": 240,
"serverId": 601,
"containerName": "apachetest",
"displayName": "apachetest",
"status": "complete",
"reason": null,
"percent": 100.0,
"statusEta": 348246,
"message": null,
"output": null,
"error": null,
"startDate": "2018-09-28T19:11:01+0000",
"endDate": "2018-09-28T19:11:33+0000",
"duration": 32219,
"dateCreated": "2018-09-28T19:11:01+0000",
"lastUpdated": "2018-09-28T19:11:33+0000",
"createdBy": {
"username": "admin",
"displayName": "Admin"
},
"updatedBy": {
"username": "admin",
"displayName": "Admin"
}
},
{
"id": 944,
"processId": 250,
"accountId": 1,
"uniqueId": "4f4088b0-7043-4a35-82c1-00456643beaa",
"processType": {
"code": "provisionResize",
"name": "resize instance"
},
"description": null,
"refType": "container",
"refId": 240,
"subType": null,
"subId": null,
"zoneId": 34,
"integrationId": null,
"instanceId": 238,
"containerId": 240,
"serverId": 601,
"containerName": "apachetest",
"displayName": "apachetest",
"status": "complete",
"reason": null,
"percent": 100.0,
"statusEta": 348246,
"message": null,
"output": null,
"error": null,
"startDate": "2018-09-28T19:11:33+0000",
"endDate": "2018-09-28T19:11:36+0000",
"duration": 2896,
"dateCreated": "2018-09-28T19:11:33+0000",
"lastUpdated": "2018-09-28T19:11:36+0000",
"createdBy": {
"username": "admin",
"displayName": "Admin"
},
"updatedBy": {
"username": "admin",
"displayName": "Admin"
}
},
{
"id": 945,
"processId": 250,
"accountId": 1,
"uniqueId": "10559e2a-6980-4443-afd4-37b7471492ba",
"processType": {
"code": "provisionCloudInit",
"name": "configure cloud init"
},
"description": null,
"refType": "container",
"refId": 240,
"subType": null,
"subId": null,
"zoneId": 34,
"integrationId": null,
"instanceId": 238,
"containerId": 240,
"serverId": 601,
"containerName": "apachetest",
"displayName": "apachetest",
"status": "complete",
"reason": null,
"percent": 100.0,
"statusEta": 348246,
"message": null,
"output": null,
"error": null,
"startDate": "2018-09-28T19:11:36+0000",
"endDate": "2018-09-28T19:11:42+0000",
"duration": 6152,
"dateCreated": "2018-09-28T19:11:36+0000",
"lastUpdated": "2018-09-28T19:11:42+0000",
"createdBy": {
"username": "admin",
"displayName": "Admin"
},
"updatedBy": {
"username": "admin",
"displayName": "Admin"
}
},
{
"id": 946,
"processId": 250,
"accountId": 1,
"uniqueId": "0081e523-bfea-4664-b582-d68076943a46",
"processType": {
"code": "provisionLaunch",
"name": "power on"
},
"description": null,
"refType": "container",
"refId": 240,
"subType": null,
"subId": null,
"zoneId": 34,
"integrationId": null,
"instanceId": 238,
"containerId": 240,
"serverId": 601,
"containerName": "apachetest",
"displayName": "apachetest",
"status": "complete",
"reason": null,
"percent": 100.0,
"statusEta": 348246,
"message": null,
"output": null,
"error": null,
"startDate": "2018-09-28T19:11:42+0000",
"endDate": "2018-09-28T19:11:45+0000",
"duration": 2549,
"dateCreated": "2018-09-28T19:11:42+0000",
"lastUpdated": "2018-09-28T19:11:45+0000",
"createdBy": {
"username": "admin",
"displayName": "Admin"
},
"updatedBy": {
"username": "admin",
"displayName": "Admin"
}
},
{
"id": 947,
"processId": 250,
"accountId": 1,
"uniqueId": "de66729e-9580-43b0-950c-f2769cd86790",
"processType": {
"code": "provisionNetwork",
"name": "network wait"
},
"description": null,
"refType": "container",
"refId": 240,
"subType": null,
"subId": null,
"zoneId": 34,
"integrationId": null,
"instanceId": 238,
"containerId": 240,
"serverId": 601,
"containerName": "apachetest",
"displayName": "apachetest",
"status": "failed",
"reason": null,
"percent": 100.0,
"statusEta": 348246,
"message": null,
"output": null,
"error": null,
"startDate": "2018-09-28T19:11:45+0000",
"endDate": "2018-09-28T20:21:49+0000",
"duration": 4204122,
"dateCreated": "2018-09-28T19:11:45+0000",
"lastUpdated": "2018-09-28T20:21:49+0000",
"createdBy": {
"username": "admin",
"displayName": "Admin"
},
"updatedBy": {
"username": "admin",
"displayName": "Admin"
}
}
]
}
}
This endpoint retrieves a specific process.
HTTP Request
GET https://api.gomorpheus.com/api/processes/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the process |
Get a Specific Process Event
curl "$MORPHEUS_API_URL/api/processes/events/940" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"processEvent": {
"id": 940,
"processId": 250,
"accountId": 1,
"uniqueId": "54bf6265-1e86-45b4-b1a7-d4b198b13c45",
"processType": {
"code": "provisionResources",
"name": "prepare resources"
},
"description": null,
"refType": "container",
"refId": 240,
"subType": null,
"subId": null,
"zoneId": 34,
"integrationId": null,
"instanceId": 238,
"containerId": 240,
"serverId": 601,
"containerName": "apachetest",
"displayName": "apachetest",
"status": "complete",
"reason": null,
"percent": 100.0,
"statusEta": 348246,
"message": null,
"output": null,
"error": null,
"startDate": "2018-09-28T19:10:56+0000",
"endDate": "2018-09-28T19:10:57+0000",
"duration": 921,
"dateCreated": "2018-09-28T19:10:56+0000",
"lastUpdated": "2018-09-28T19:10:57+0000",
"createdBy": {
"username": "admin",
"displayName": "Admin"
},
"updatedBy": {
"username": "admin",
"displayName": "Admin"
}
}
}
This endpoint retrieves a specific process event.
HTTP Request
GET https://api.gomorpheus.com/api/processes/events/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the process event |
Health
Provides API interfaces for checking health status. This is the status of the morpheus appliance itself, which includes elasticsearch, mysql etc.
Get Health Status
curl "$MORPHEUS_API_URL/api/health" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"health": {
"success": true,
"date": "2019-12-23T19:14:41Z",
"cpu": {
"success": true,
"cpuLoad": 0.5126493909536541,
"cpuTotalLoad": 5.302748759909017,
"processorCount": 16,
"processTime": 52169711.18,
"systemLoad": 2.9423828125,
"status": "ok"
},
"memory": {
"success": true,
"maxMemory": 7635730432,
"totalMemory": 6765936640,
"freeMemory": 197682472,
"usedMemory": 6568254168,
"systemMemory": 34359738368,
"comittedMemory": 18334928896,
"systemFreeMemory": 474562560.0,
"systemSwap": 34359738368,
"systemFreeSwap": 34359738368,
"swapPercent": 0.0,
"memoryPercent": 0.9707826894,
"systemMemoryPercent": 0.9861884117126465,
"status": "warning",
"statusMessage": "heavy memory usage, consider increasing morpheus memory"
}
}
The above JSON is abbreviated, the actual response contains more data.
This endpoint retrieves health info about the Morpheus appliance such as cpu, memory and database usage. Elasticsearch statistics and queue usage are also returned.
HTTP Request
GET https://api.gomorpheus.com/api/health
Get All Health Alarms
curl "$MORPHEUS_API_URL/api/health/alarms" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"alarms": [
],
"meta": {
"size": 2,
"total": 2,
"offset": 0,
"max": 25
}
}
This endpoint retrieves all health alarms, which are Operation notifications from Cloud and other Service Integrations. These alarms are not generated by Morpheus but synced and displayed for visibility in Morpheus. By default only open alarms are returned. Open alarms are those that have not yet been acknowledged.
HTTP Request
GET https://api.gomorpheus.com/api/health/alarms
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 | Filter by matching name | |
name | Filter by name | |
acknowledged | Filter by acknowledged flag |
Get a Specific Health Alarm
curl "$MORPHEUS_API_URL/api/health/alarms/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"alarm": {
"id": 1,
"name": "foobar",
"dateCreated": "2019-11-17T05:59:20+0000",
"lastUpdated": "2019-11-17T05:59:20+0000"
}
}
This endpoint will retrieve a specific health alarm by ID.
HTTP Request
GET https://api.gomorpheus.com/api/health/alarms/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the alarm |
Acknowledge a Health Alarm
curl -XPUT "$MORPHEUS_API_URL/api/health/alarms/1/acknowledge" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"alarm":{
"acknowledged": true,
}}'
The above command returns JSON structured like this:
{
"success": true
}
This endpoint acknowledge the specified health alarm. This marks it as acknowledged so it will no longer appear in the list of open alarms.
HTTP Request
PUT https://api.gomorpheus.com/api/health/alarms/1/acknowledge
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the alarm |
JSON Parameters
The following parameters are passed inside an object named alarm
.
Parameter | Default | Description |
---|---|---|
acknowledged | Pass true to ackowledge an alarm, or pass false to unacknowledge it. |
Acknowledge Many Health Alarms
curl -XPUT "$MORPHEUS_API_URL/api/health/alarms/acknowledge" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"ids": [1,2,3,4,5],
"alarm":{
"acknowledged": true
}}'
The above command returns JSON structured like this:
{
"success": true
}
This endpoint acknowledges health alarms. It allows many alarms to be acknowledged at once by specifying ids
, or acknowledging all alarms via the all
flag.
HTTP Request
PUT https://api.gomorpheus.com/api/health/alarms/acknowledge
JSON Parameters
Parameter | Default | Description |
---|---|---|
ids | [] | Array of Alarm ID(s)to be updated. |
all | false | Pass true to update all alarms instead of passing ids . This will update any active alarm that is not already acknowledged. |
acknowledged | true | Pass false to unacknowledge the alarm(s) instead of acknowledge them. |
Get All Health Logs
curl "$MORPHEUS_API_URL/api/health/logs" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"logs": [
{
"typeCode": "appliance",
"ts": "2020-01-05T03:09:04Z",
"level": "ERROR",
"sourceType": "appliance",
"message": "[pool-2-thread-7] Failure in api call",
"hostname": "labs-den-m1",
"objectId": "1",
"seq": 106678,
"_id": "324c518d-eb37-41d8-bf13-1cec8bfa0b05"
},
{
"typeCode": "appliance",
"ts": "2020-01-05T03:08:59Z",
"level": "INFO",
"sourceType": "appliance",
"message": "[pool-2-thread-7] duplicate key: 9825f604-7dd0-4c5f-b1c2-f3e0769bd95c total: 2 remove count: 2",
"hostname": "labs-den-m1",
"objectId": "1",
"seq": 106522,
"_id": "e97faab1-32c7-4d08-8025-34f12776c583"
}
],
"meta": {
"size": 2,
"total": 10000,
"max": "2",
"offset": 0
}
}
This endpoint retrieves all health logs. These are the logs of the remote appliance itself. These logs show all ui activity and are useful for troubleshooting and auditing. Stack traces are filtered for Morpheus services. Complete stack traces can be found in /var/log/morpheus/morpheus-ui/current.
HTTP Request
GET https://api.gomorpheus.com/api/health/logs
Query Parameters
Parameter | Default | Description |
---|---|---|
max | 25 | Max number of results to return |
offset | 0 | Offset of records you want to load |
sort | ts | Sort order |
order | desc | Sort direction |
query | Filter by wildcard search of fields |
Guidance
Provides API interfaces for managing guidance within Morpheus
Get All Discoveries
curl "$MORPHEUS_API_URL/api/guidance" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"discoveries": [
{
"id": 3405,
"dateCreated": "2019-03-05T23:05:02+0000",
"lastUpdated": "2020-03-21T00:05:05+0000",
"actionCategory": "reservation",
"actionMessage": "Reservation recommentations",
"actionTitle": "reserve.compute",
"actionType": "reserve",
"actionValue": "34.519463385782942",
"actionValueType": "reservation",
"actionPlanId": null,
"statusMessage": "Reservation recommendations for cloud QA Azure",
"accountId": 1,
"userId": null,
"siteId": 2,
"zone": {
"id": 4,
"name": "QA Azure",
"zoneType": {
"id": 9,
"name": "Azure (Public)"
}
},
"state": "processed",
"stateMessage": "shutdown resource",
"severity": "info",
"resolved": false,
"resolvedMessage": null,
"refType": "computeZone",
"refId": 4,
"refName": "QA Azure",
"type": {
"id": 6,
"name": "Reservation Recommendation",
"code": "reservations",
"title": "Add Reservations"
},
"savings": {
"amount": 34.51946338578294,
"currency": "USD"
},
"config": {
"success": true,
"detailList": [
{
"id": "billingAccount/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Consumption/reservationRecommendations/90bfe546-0ea4-8e62-4afb-975bbc9e83ac",
"apiName": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"apiType": "Microsoft.Consumption/reservationRecommendations",
"externalId": "Standard_D2",
"period": "Last30Days",
"name": "Standard_D2",
"type": "Standard_D2",
"category": "Standard_D2",
"size": "Standard_D2 (Cores: 2, Memory: 7 GB) (eastus)",
"region": "westus",
"term": "P1Y",
"meterId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"onDemandCount": 0,
"onDemandCost": 110.99038119400001,
"reservedCount": 0,
"reservedCost": 0,
"recommendedCount": 1,
"recommendedCost": 76.47091780821707,
"totalSavings": 34.51946338578294,
"totalSavingsPercent": 0.311013107752521
}
],
"services": {
"azureVms": {
"code": "azureVms",
"name": "Azure Virtual Machines",
"paymentOptions": {
"NO_UPFRONT": {
"code": "NO_UPFRONT",
"name": "No Upfront",
"termOptions": {
"{code=P1Y, name=1 Year, defaultOption=true}": {
"code": "P1Y",
"name": "1 Year",
"detailList": [
{
"id": "billingAccount/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Consumption/reservationRecommendations/90bfe546-0ea4-8e62-4afb-975bbc9e83ac",
"apiName": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"apiType": "Microsoft.Consumption/reservationRecommendations",
"externalId": "Standard_D2",
"period": "Last30Days",
"name": "Standard_D2",
"type": "Standard_D2",
"category": "Standard_D2",
"size": "Standard_D2 (Cores: 2, Memory: 7 GB) (eastus)",
"region": "westus",
"term": "P1Y",
"meterId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx5",
"onDemandCount": 0,
"onDemandCost": 110.99038119400001,
"reservedCount": 0,
"reservedCost": 0,
"recommendedCount": 1,
"recommendedCost": 76.47091780821707,
"totalSavings": 34.51946338578294,
"totalSavingsPercent": 0.311013107752521
}
],
"summary": {
"totalSavings": 34.51946338578294,
"currencyCode": "USD",
"totalSavingsPercent": 0.311013107752521,
"term": "",
"paymentOption": "",
"service": "compute",
"onDemandCount": 0,
"onDemandCost": 110.99038119400001,
"reservedCount": 0,
"reservedCost": 0,
"recommendedCount": 1,
"recommendedCost": 76.47091780821707
}
},
"{code=P3Y, name=3 Year}": {
"code": "P3Y",
"name": "3 Year",
"detailList": [
{
"id": "billingAccount/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Consumption/reservationRecommendations/90bfe546-0ea4-8e62-4afb-975bbc9e83ac",
"apiName": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"apiType": "Microsoft.Consumption/reservationRecommendations",
"externalId": "Standard_D2",
"period": "Last30Days",
"name": "Standard_D2",
"type": "Standard_D2",
"category": "Standard_D2",
"size": "Standard_D2 (Cores: 2, Memory: 7 GB) (eastus)",
"region": "westus",
"term": "P3Y",
"meterId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"onDemandCount": 0,
"onDemandCost": 110.99038119400001,
"reservedCount": 0,
"reservedCost": 0,
"recommendedCount": 1,
"recommendedCost": 49.160529680364135,
"totalSavings": 61.82985151363587,
"totalSavingsPercent": 0.557073963063191
}
],
"summary": {
"totalSavings": 61.82985151363587,
"currencyCode": "USD",
"totalSavingsPercent": 0.557073963063191,
"term": "",
"paymentOption": "",
"service": "compute",
"onDemandCount": 0,
"onDemandCost": 110.99038119400001,
"reservedCount": 0,
"reservedCost": 0,
"recommendedCount": 1,
"recommendedCost": 49.160529680364135
}
}
}
}
}
}
},
"summary": {
"totalSavings": 34.51946338578294,
"currencyCode": "USD",
"totalSavingsPercent": 0.311013107752521,
"term": "",
"paymentOption": "",
"service": "compute",
"onDemandCount": 0,
"onDemandCost": 110.99038119400001,
"reservedCount": 0,
"reservedCost": 0,
"recommendedCount": 1,
"recommendedCost": 76.47091780821707
}
}
}
],
"meta": {
"size": 1,
"total": 1,
"max": 50,
"offset": 0
}
}
This endpoint retrieves discoveries. By default, only includes discoveries that have not been ignored or executed.
HTTP Request
GET https://api.gomorpheus.com/api/guidance
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 | Reference name, status message and action, restricts query to only load discoveries which contain the phrase specified | |
severity | Severity level filter, restricts query to only load discoveries of specified severity level: info, low, warning, critical | |
type | Discovery type filter, restricts query to only load discoveries of specified discover type. See discovery types | |
state | Filter by state, restricts query to only load discoveries by state: any, processed, ignored |
Get a Specific Discovery
curl "$MORPHEUS_API_URL/api/guidance/2" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"discovery": {
"id": 2,
"dateCreated": "2020-03-18T17:36:09+0000",
"lastUpdated": "2020-03-21T18:49:27+0000",
"actionCategory": "power",
"actionMessage": "Shutdown 10.30.21.76",
"actionTitle": "shutdown",
"actionType": "shutdown",
"actionValue": "off",
"actionValueType": "power",
"actionPlanId": null,
"statusMessage": "Utilization for virtual machine 10.30.21.76 suggests it is not in use",
"accountId": 1,
"userId": null,
"siteId": null,
"zone": {
"id": 4,
"name": "Denver VMware Virtual Center Cloud",
"zoneType": {
"id": 14,
"name": "VMware vCenter"
}
},
"state": "processed",
"stateMessage": "shutdown resource",
"severity": "info",
"resolved": true,
"resolvedMessage": null,
"refType": "computeServer",
"refId": 6,
"refName": "10.30.21.76",
"type": {
"id": 1,
"name": "Shutdown",
"code": "shutdown",
"title": "Shutdown resource"
},
"savings": {
"amount": 40.0,
"currency": "USD"
},
"resource": {
"id": 6,
"externalId": "host-58630",
"internalId": null,
"externalUniqueId": null,
"accountId": 1,
"account": {
"name": "Stubby Toes Inc."
},
"name": "10.30.21.76",
"visibility": "private",
"description": null,
"zoneId": 4,
"siteId": 4,
"resourcePoolId": 9,
"folderId": null,
"sshHost": null,
"sshPort": 22,
"externalIp": null,
"internalIp": null,
"volumeId": null,
"platform": null,
"platformVersion": null,
"sshUsername": "xxxxx",
"sshPassword": null,
"osDevice": "/dev/sda",
"osType": "esxi",
"dataDevice": "/dev/sdb",
"lvmEnabled": true,
"apiKey": "xxxxx",
"softwareRaid": false,
"dateCreated": "2019-07-29T19:05:31+0000",
"lastUpdated": "2020-02-26T07:10:59+0000",
"stats": {
"ts": "2020-02-26T07:10:59Z",
"freeMemory": 94497890304,
"maxMemory": 137402474496,
"usedMemory": 42904584192,
"maxStorage": 3000483446784,
"usedStorage": 897040577986,
"cpuUsage": 10.99583333
},
"status": "provisioned",
"statusMessage": null,
"errorMessage": null,
"statusDate": "2019-07-29T19:05:31+0000",
"statusPercent": null,
"statusEta": null,
"powerState": "on",
"computeServerType": {
"id": 157,
"code": "vmwareHypervisor",
"name": "vSphere Hypervisor",
"managed": false,
"externalDelete": false
},
"agentInstalled": false,
"lastAgentUpdate": null,
"agentVersion": null,
"maxCores": 12,
"maxMemory": 137402474496,
"maxStorage": 3000483446784,
"maxCpu": null,
"serverOs": {
"id": 53,
"name": "esxi 6",
"description": null,
"vendor": "vmware",
"category": "esxi",
"osFamily": null,
"osVersion": "6",
"bitCount": 64,
"platform": "esxi"
},
"enabled": true,
"tagCompliant": null,
"zone": {
"id": 4,
"name": "VMware Virtual Center Cloud"
},
"plan": {
"id": null,
"code": null,
"name": null
},
"containers": [
]
},
"config": {
"exists": true,
"objectId": 6,
"networkBandwidthCount": 0,
"networkBandwidthMin": 0,
"networkBandwidthMax": 0,
"networkBandwidthAvg": 0,
"networkBandwidthSum": 0,
"netRxUsageCount": 5,
"netRxUsageMin": 0,
"netRxUsageMax": 185.0,
"netRxUsageAvg": 108.2,
"netRxUsageSum": 541.0,
"cpuSystemTimeCount": 0,
"cpuSystemTimeMin": 0,
"cpuSystemTimeMax": 0,
"cpuSystemTimeAvg": 0,
"cpuSystemTimeSum": 0,
"cpuTotalTimeCount": 0,
"cpuTotalTimeMin": 0,
"cpuTotalTimeMax": 0,
"cpuTotalTimeAvg": 0,
"cpuTotalTimeSum": 0,
"cpuUsageCount": 0,
"cpuUsageMin": 0,
"cpuUsageMax": 0,
"cpuUsageAvg": 0,
"cpuUsageSum": 0,
"netTxUsageCount": 5,
"netTxUsageMin": 0,
"netTxUsageMax": 244.0,
"netTxUsageAvg": 156.4,
"netTxUsageSum": 782.0,
"cpuUserTimeCount": 0,
"cpuUserTimeMin": 0,
"cpuUserTimeMax": 0,
"cpuUserTimeAvg": 0,
"cpuUserTimeSum": 0,
"cpuIdleTimeCount": 0,
"cpuIdleTimeMin": 0,
"cpuIdleTimeMax": 0,
"cpuIdleTimeAvg": 0,
"cpuIdleTimeSum": 0
}
}
}
This endpoint retrieves a specific discovery.
HTTP Request
GET https://api.gomorpheus.com/api/guidance/:id
URL Parameters
Parameter | Description |
---|---|
id | ID of the discovery |
Get Guidance Stats
curl "$MORPHEUS_API_URL/api/guidance/stats" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"stats": {
"total": 14,
"savings": {
"amount": -165.98050103021708,
"currency": "USD"
},
"severity": {
"low": 0,
"info": 14,
"warning": 0,
"critical": 0
},
"type": {
"size": 13,
"shutdown": 0,
"move": 0,
"schedule": 0
}
}
}
This endpoint retrieves a summary of actionable discoveries.
HTTP Request
GET https://api.gomorpheus.com/api/guidance/stats
Get Discovery Types
curl "$MORPHEUS_API_URL/api/guidance/types" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"types": [
{
"id": 1,
"name": "Shutdown",
"code": "shutdown",
"category": "utilization",
"title": "Shutdown resource"
},
{
"id": 2,
"name": "Sizing",
"code": "size",
"category": "utilization",
"title": "Resize resource"
},
{
"id": 3,
"name": "Host Capacity",
"code": "hostCapacity",
"category": "utilization",
"title": "Add Capacity"
},
{
"id": 4,
"name": "Host Balancing",
"code": "hostBalancing",
"category": "utilization",
"title": "Balance Host"
},
{
"id": 5,
"name": "Datastore Capacity",
"code": "datastoreCapacity",
"category": "utilization",
"title": "Add Capacity"
},
{
"id": 6,
"name": "Reservation Recommendation",
"code": "reservations",
"category": "utilization",
"title": "Add Reservations"
}
]
}
This endpoint retrieves a list of discovery types.
HTTP Request
GET https://api.gomorpheus.com/api/guidance/types
Execute a Discovery
Use this command to execute a discovery.
curl -XPUT "$MORPHEUS_API_URL/api/guidance/1/execute" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
-H "Content-Type: application/json"
The above command returns JSON structured like this:
{
"success": true
}
HTTP Request
PUT https://api.gomorpheus.com/api/guidance/:id/execute
URL Parameters
Parameter | Description |
---|---|
id | The ID of the discovery |
Ignore a Discovery
Use this command to ignore a discovery.
curl -XPUT "$MORPHEUS_API_URL/api/guidance/1/ignore" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
-H "Content-Type: application/json"
The above command returns JSON structured like this:
{
"success": true
}
HTTP Request
PUT https://api.gomorpheus.com/api/guidance/:id/ignore
URL Parameters
Parameter | Description |
---|---|
id | The ID of the discovery |
Provisioning
The Provisioning API endpoints provide management of Instances, Apps, Automation and Deployments.
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 ProvisionType
. 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
Fetch the list of available provision types.
curl "$MORPHEUS_API_URL/api/provision-types"
-H "Authorization: BEARER $MORPHEUS_API_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
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 | Name and code, restricts query to only load provision types which contain the phrase specified | |
name | Name filter, restricts query to only load type matching name specified | |
code | Code filter, restricts query to only load type matching code specified |
Get Specific Provision Type
curl "$MORPHEUS_API_URL/api/provision-types/9"
-H "Authorization: BEARER $MORPHEUS_API_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
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 "$MORPHEUS_API_URL/api/instances?max=3"
-H "Authorization: BEARER $MORPHEUS_API_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
],
"servers": [
2
],
"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
],
"servers": [
2
],
"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
],
"servers": [
3
],
"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,
"owner": {
"id": 1,
"username": "admin"
}
}
],
"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": 25,
"size": 3,
"total": 21
}
}
This endpoint retrieves a paginated list of instances.
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 |
name | Filter by name | |
phrase | Filter by wildcard search of name and description | |
instanceType | Filter by instance type code | |
lastUpdated | Date filter, restricts query to only load instances updated timestamp is more recent or equal to the date specified | |
createdBy | Filter by Created By (User) ID. Accepts multiple values. | |
status | Filter by instance type status | |
showDeleted | false | If true, includes instances in pending removal status. |
deleted | If true, only instances in pending removal status are returned. | |
expireDate | Filter by expireDate less than equal to specified date | |
expireDateMin | Filter expireDate greater than or equal to the specified date | |
expireDays | Filter by expireDays less than or equal to the specified value | |
expireDaysMin | Filter by expireDays greater than or equal to the specified value | |
shutdownDate | Filter by shutdownDate less than equal to the specified date | |
shutdownDateMin | Filter by shutdownDate greater than or equal to the specified date | |
shutdownDays | Filter by shutdownDays less than or equal to the specified value | |
shutdownDaysMin | Filter by shutdownDays greater than or equal to the specified value | |
labels | Filter by label(s). | |
tags | Filter by tags (metadata). This allows filtering by arbitrary tag names and values like this tags.foo=bar . |
|
metadata | Alias for tags . |
Get a Specific Instance
curl "$MORPHEUS_API_URL/api/instances/1216" \
-H "Authorization: BEARER $MORPHEUS_API_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
],
"servers": [
2
],
"connectionInfo": [
{
"ip": "10.211.55.11",
"port": 10000
}
],
"layout": {
"id": 221
},
"plan": {
"id": 69,
"code": "container-512"
},
"name": "redistest",
"description": null,
"instanceVersion": null,
"labels": [
"web"
],
"tags": [
["id": 55, "name": "Category", "value": "Web"]
],
"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,
"owner": {
"id": 1,
"username": "admin"
}
},
"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
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
Get Env Variables
curl "$MORPHEUS_API_URL/api/instances/1216/envs" \
-H "Authorization: BEARER $MORPHEUS_API_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
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
Get Instance History
curl "$MORPHEUS_API_URL/api/instances/238/history" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"processes": [
{
"id": 250,
"accountId": 1,
"uniqueId": "cebc47ec-cb2f-417a-886e-dd60cf81db26",
"processType": {
"code": "provision",
"name": "provision"
},
"description": null,
"subType": null,
"subId": null,
"zoneId": 34,
"integrationId": null,
"instanceId": 238,
"containerId": 240,
"serverId": 601,
"containerName": "apachetest",
"displayName": "apachetest",
"timerCategory": "vmware",
"timerSubCategory": "28",
"status": "failed",
"reason": null,
"percent": 100.0,
"statusEta": 348246,
"message": null,
"output": null,
"error": null,
"startDate": "2018-09-28T19:10:56+0000",
"endDate": "2018-09-28T20:21:49+0000",
"duration": 4253127,
"dateCreated": "2018-09-28T19:10:56+0000",
"lastUpdated": "2018-09-28T20:21:49+0000",
"createdBy": {
"username": "admin",
"displayName": "Admin"
},
"updatedBy": {
"username": "admin",
"displayName": "Admin"
},
"events": [
]
}
],
"meta": {
"size": 1,
"total": 1,
"offset": 0,
"max": 25
}
}
This endpoint retrieves the process history for a specific instance.
Alternatively, the Process History endpoint can be used to get the same information.
HTTP Request
GET https://api.gomorpheus.com/api/instances/:id/history
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
Query Parameters
Parameter | Default | Description |
---|---|---|
phrase | If specified will return a partial match on displayName, message or output | |
containerId | Filter by container id(s) | |
serverId | Filter by server id(s) | |
zoneId | Filter by zone id(s) |
Get Container Details
curl "$MORPHEUS_API_URL/api/instances/1216/containers" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"containers": [
{
"id": 292,
"accountId": 1,
"instance": {
"id": 294,
"name": "nginxtest"
},
"containerType": {
"id": 187,
"code": "nginx-vmware-1.9",
"category": "nginx",
"name": "NGINX 1.9"
},
"containerTypeSet": {
"id": 193,
"code": "nginx-vmware-1.9-set",
"category": "nginx"
},
"server": {
"id": 653,
"name": "nginxtest"
},
"cloud": {
"id": 34,
"name": "myvmware"
},
"name": "nginxtest_292",
"ip": "10.30.20.50",
"internalIp": "10.30.20.50",
"internalHostname": "container292",
"externalHostname": "nginxtest",
"externalDomain": "localdomain",
"externalFqdn": "nginxtest.localdomain",
"ports": [
{
"index": 0,
"external": 80,
"internal": 80,
"primaryPort": true,
"displayName": "Http",
"export": true,
"visible": true,
"loadBalance": true,
"link": true,
"exportName": "HTTP",
"protocol": "http",
"code": "nginx.80"
},
{
"index": 1,
"external": 443,
"internal": 443,
"primaryPort": false,
"displayName": "Https",
"export": true,
"visible": true,
"loadBalance": true,
"link": true,
"exportName": "HTTPS",
"protocol": "https",
"code": "nginx.443"
}
],
"plan": {
"id": 76,
"code": "vm-1024",
"name": "1 CPU, 1GB Memory"
},
"dateCreated": "2019-02-20T18:29:05+0000",
"lastUpdated": "2019-02-27T21:07:35+0000",
"statsEnabled": true,
"status": "running",
"userStatus": "running",
"environmentPrefix": null,
"stats": {
"ts": "2019-02-27T21:07:31+0000",
"running": true,
"userCpuUsage": 0.1504010695,
"systemCpuUsage": 0.1838235294,
"usedMemory": 317256000,
"maxMemory": 1017032000,
"cacheMemory": 404236000,
"maxStorage": 10499452928,
"usedStorage": 3700285440,
"readIOPS": 0,
"writeIOPS": 0.35,
"totalIOPS": 0.35,
"iops": {
},
"netTxUsage": 114,
"netRxUsage": 2198
},
"runtimeInfo": {
},
"containerVersion": null,
"repositoryImage": null,
"planCategory": null,
"hostname": "nginxtest",
"domainName": null,
"volumeCreated": true,
"containerCreated": false,
"maxStorage": 10737418240,
"maxMemory": 1073741824,
"maxCores": 1,
"maxCpu": 1,
"availableActions": [
{
"code": "nginx-1.9-remove-node",
"name": "Remove Nginx Node"
}
]
}
]
}
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
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
Get All Instance Types for Provisioning
curl "$MORPHEUS_API_URL/api/instance-types"
-H "Authorization: BEARER $MORPHEUS_API_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 **/ }
}
]
}
]
}
Fetch the list of available instance types. These can vary in range from database containers, to web containers, to custom containers.
HTTP Request
GET https://api.gomorpheus.com/api/instance-types
Get Specific Instance Type for Provisioning
curl "$MORPHEUS_API_URL/api/instance-types/12"
-H "Authorization: BEARER $MORPHEUS_API_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 **/ }
}
]
}
}
Fetch an instance type by ID.
HTTP Request
GET https://api.gomorpheus.com/api/instance-types/:id
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance type |
Get Available Service Plans for an Instance
curl -XGET "https://api.gomorpheus.com/api/instances/service-plans?zoneId=1&layoutId=75" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structure like this:
{
"plans": [
{
"id": 75,
"name": "1 CPU, 512MB Memory",
"value": 75,
"code": "vm-512",
"maxStorage": 10737418240,
"maxMemory": 536870912,
"maxCpu": 1,
"maxCores": 1,
"customCpu": false,
"customMaxMemory": false,
"customMaxStorage": true,
"customMaxDataStorage": true,
"customCoresPerSocket": false,
"coresPerSocket": 1,
"storageTypes": [
{
"id": 1,
"editable": false,
"optionTypes": [
],
"displayOrder": 1,
"code": "standard",
"volumeType": "disk",
"minStorage": null,
"deletable": false,
"defaultType": true,
"createDatastore": null,
"resizable": false,
"storageType": null,
"allowSearch": true,
"volumeOptionSource": null,
"displayName": "Disk",
"minIOPS": null,
"maxIOPS": null,
"hasDatastore": true,
"customSize": true,
"autoDelete": true,
"name": "Standard",
"configurableIOPS": false,
"customLabel": true,
"enabled": true,
"description": "Standard",
"volumeCategory": "disk",
"externalId": null,
"maxStorage": null
}
],
"rootStorageTypes": [
{
"id": 1,
"editable": false,
"optionTypes": [
],
"displayOrder": 1,
"code": "standard",
"volumeType": "disk",
"minStorage": null,
"deletable": false,
"defaultType": true,
"createDatastore": null,
"resizable": false,
"storageType": null,
"allowSearch": true,
"volumeOptionSource": null,
"displayName": "Disk",
"minIOPS": null,
"maxIOPS": null,
"hasDatastore": true,
"customSize": true,
"autoDelete": true,
"name": "Standard",
"configurableIOPS": false,
"customLabel": true,
"enabled": true,
"description": "Standard",
"volumeCategory": "disk",
"externalId": null,
"maxStorage": null
}
],
"addVolumes": true,
"customizeVolume": true,
"rootDiskCustomizable": true,
"noDisks": false,
"hasDatastore": true,
"minDisk": 0,
"maxDisk": null,
"lvmSupported": true,
"datastores": {
"cluster": [
{
"id": 54,
"name": "demo-qnap - 4.3TB Free"
}
],
"store": [
{
"id": 50,
"name": "datastore1 - 463.4GB Free"
}
]
},
"supportsAutoDatastore": true,
"autoOptions": [
{
"id": "autoCluster",
"name": "Auto - Cluster"
},
{
"id": "auto",
"name": "Auto - Datastore"
}
],
"cpuOptions": [
],
"coreOptions": [
],
"memoryOptions": [
],
"rootCustomSizeOptions": {
},
"customSizeOptions": {
},
"customCores": false,
"maxDisks": null,
"memorySizeType": "MB"
}
]
}
This returns a list of all of the service plans available for an instance type. The response includes details about the plans and their configuration options. The parameters zoneId and layoutId are required.
This endpoint can be used to get the list of plans available for creating a new instance or resizing an existing instance.
HTTP Request
GET https://api.gomorpheus.com/api/instances/service-plans
Query Parameters
Parameter | Description |
---|---|
zoneId | The ID of the Cloud |
layoutId | The ID of the instance layout |
Create an Instance
curl -X POST "https://api.gomorpheus.com/api/instances" \
-H "Authorization: BEARER $MORPHEUS_API_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": "autoCluster"
},
{
"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"}
],
"labels": [
"foo", "bar"
],
"tags": [
{"name": "hello", "value": "world"},
{"name": "flash", "value": "bang"}
]
}'
The above command returns a similar JSON structure when submitting a GET request for a single instance
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 | Name of the instance to be created | |
instance.site.id | Y | The Group ID to provision the instance into | |
instance.instanceType.code | Y | The type of instance by code we want to fetch | |
instance.layout.id | Y | The layout id for the instance type that you want to provision. i.e. single process or cluster | |
instance.plan.id | Y | The id for the memory and storage option pre-configured within Morpheus. See Available Service Plans | |
zoneId | Y | 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 | Map of custom options depending on selected service plan . An example would be maxMemory , or maxCores . |
|
securityGroups | N | 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 | Key for volume configuration, see Volumes | |
networkInterfaces | N | Key for network configuration, see Network Interfaces | |
config | Y | Key for specific type configuration, see Config | |
labels | N | Array of strings (keywords) | |
tags | N | Metadata tags, Array of objects having a name and value. | |
metadata | N | Alias for tags |
|
ports | N | Array of port objects, see Exposed Ports | |
taskSetId | N | The Workflow ID to execute. | |
taskSetName | N | The Workflow Name to execute. |
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 | Can be used to select pre-existing LV choices from Morpheus | |
storageType | N | Identifier for LV type | |
datastoreId | Y | The ID of the specific datastore. Auto selection can be specified as auto or autoCluster (for clusters). |
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. A network group can be specified instead by prefixing its ID with networkGroup- . |
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. |
Exposed Ports
The ports
parameter is for port configuration.
The layout may have default ports, which are defined in node types, that are always configured. This parameter will be for additional custom ports to be opened.
It should be passed as an array of Objects with the following attributes:
Parameter | Required | Default | Description |
---|---|---|---|
port | Y | n/a | port number. eg. 8080 |
name | N | n/a | A name for the port eg. web |
lb | N | The load balancer protocol. HTTP , HTTPS , or TCP . Default is none. |
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 | ID of a public key to add to the instance | |
resourcePoolId | Y | External ID of the resource group to use for instance | |
hostId | N | Specific host to deploy to if so desired | |
vmwareUsr | N | Additional user to provision to instance | |
vmwarePwd | N | Password for additional user | |
vmwareDomainName | N | Domain name to be given to instance | |
vmwareCustomSpec | N | Customization spec ID |
JSON Config Parameters for Docker
Parameter | Required | Default | Description |
---|---|---|---|
provisionServerId | N | Specific host to deploy to if so desired | |
resourcePoolId | Y | External ID of the resource group to use for instance |
JSON Config Parameters for Kubernetes
Parameter | Required | Default | Description |
---|---|---|---|
resourcePoolId | Y | ID of the resource group (kubernetes cluster) to use for instance |
Metadata
This is specific to AWS Metadata tags. Name-Values pairs can be anything you like and are added to the instance JSON as an array of n-v pairs per the example to the right:
-d '{
"zoneId": 6,
"instance": {
...
}
...
"tags": [
{
"name": "SampleName",
"value": "SampleValue"
}
{
"name": "BusinessUnit",
"value": "QualityAssurance"
}
]
...
}
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.
Updating an Instance
curl -X PUT "https://api.gomorpheus.com/api/instances/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "instance": {
"description": "my new redis",
"addTags": [
{"name": "hello", "value": "world"},
{"name": "flash", "value": "bang"}
],
"removeTags": [
{"name": "oldTag"}
]
}}'
The above command returns a similar JSON structure when submitting a GET request for a single instance
HTTP Request
PUT https://api.gomorpheus.com/api/instances/:id
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
JSON Instance Parameters
Parameter | Default | Description |
---|---|---|
name | Unique name scoped to your account for the instance | |
description | Optional description field | |
instanceContext | Environment | |
labels | Array of strings (keywords) | |
tags | Metadata tags, Array of objects having a name and value, this adds or updates the specified tags and removes any tags not specified. | |
addTags | Add or update value of Metadata tags, Array of objects having a name and value | |
removeTags | Remove Metadata tags, Array of objects having a name and an optional value. If value is passed, it must match to be removed. | |
powerScheduleType | Power Schedule ID | |
site.id | Group ID | |
ownerId | User ID, can be used to change instance owner. |
Stop an Instance
curl -X PUT "https://api.gomorpheus.com/api/instances/1/stop" \
-H "Authorization: BEARER $MORPHEUS_API_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
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
Start an Instance
curl -X PUT "https://api.gomorpheus.com/api/instances/1/start" \
-H "Authorization: BEARER $MORPHEUS_API_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
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
Restart an Instance
curl -X PUT "https://api.gomorpheus.com/api/instances/1/restart" \
-H "Authorization: BEARER $MORPHEUS_API_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
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
Suspend an Instance
curl -X PUT "https://api.gomorpheus.com/api/instances/1/suspend" \
-H "Authorization: BEARER $MORPHEUS_API_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/suspend
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
Eject an Instance
curl -X PUT "https://api.gomorpheus.com/api/instances/1/eject" \
-H "Authorization: BEARER $MORPHEUS_API_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
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
Resize an Instance
curl -X PUT "https://api.gomorpheus.com/api/instances/1/resize" \
-H "Authorization: BEARER $MORPHEUS_API_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
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
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) |
Run Workflow on an Instance
curl -X PUT "https://api.gomorpheus.com/api/instances/1/workflow?workflowId=99" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-d '{ "taskSet": {
"customOptions": {"foo":"bar"}
}}'
The above command returns JSON structure like this:
{
"success": true
}
This will run a provisioning workflow on all containers in an instance.
For operational workflows, see Execute a Workflow.
HTTP Request
PUT https://api.gomorpheus.com/api/instances/:id/workflow
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
Query Parameters
Parameter | Description |
---|---|
workflowId | ID of the workflow to execute |
workflowName | Name of the workflow to execute |
JSON Parameters
Parameter | Default | Description |
---|---|---|
taskSet | Object containing workflow configuration parameters | |
taskSet.customOptions | Object containing any custom option type configuration parameters |
Clone an Instance
curl -X PUT "https://api.gomorpheus.com/api/instances/1/clone" \
-H "Authorization: BEARER $MORPHEUS_API_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
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
JSON Parameters
Parameter | Default | Description |
---|---|---|
group | null | the map containing the id of the server group you would like to clone into. |
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. |
This endpoint also supports all of the same parameters as [Create and Instance][#create-an-instance], so you can override any configuration options when provisioning the clone.
Backup an Instance
curl -X PUT "https://api.gomorpheus.com/api/instances/1773/backup" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structure that looks like this:
{
"success": true
}
HTTP Request
PUT https://api.gomorpheus.com/api/instances/:id/backup
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
Get list of backups for an Instance
curl "$MORPHEUS_API_URL/api/instances/1773/backups" \
-H "Authorization: BEARER $MORPHEUS_API_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
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
Get list of snapshots for an Instance
curl "$MORPHEUS_API_URL/api/instances/1773/snapshots" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structure that looks like this:
{
"snapshots": [
]
}
HTTP Request
GET https://api.gomorpheus.com/api/instances/:id/snapshots
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
Snapshot an Instance
curl -X PUT "https://api.gomorpheus.com/api/instances/1773/snapshot" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "snapshot": {
"name": "snapshot-test",
"description": "A snapshot created via the morpheus api",
}
}'
The above command returns JSON structure that looks like this:
{
"success": true
}
This endpoint will create a snapshot of an instance. This is done asychronously, so the ID of the snapshot is not returned.
HTTP Request
PUT https://api.gomorpheus.com/api/instances/:id/snapshot
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
JSON Snapshot Parameters
These parameters are passed under an object named snapshot
.
Parameter | Default | Description |
---|---|---|
name | “{serverName}.{timestamp}” | Optional name for the snapshot being created. |
description | Optional description for the snapshot |
Import Snapshot of an Instance
curl -X PUT "https://api.gomorpheus.com/api/instances/1/import-snapshot" \
-H "Authorization: BEARER $MORPHEUS_API_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
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
JSON Parameters
Parameter | Default | Description |
---|---|---|
storageProviderId | null | Optional storage provider to use. |
Clone to Image
curl -X PUT "https://api.gomorpheus.com/api/instances/1/clone" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "templateName": "Example Image" }'
The above command returns JSON structure like this:
{
"success": true
}
This endpoint allows creating an image template from an existing instance.
HTTP Request
PUT https://api.gomorpheus.com/api/instances/:id/clone-image
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
JSON Parameters
Parameter | Default | Description |
---|---|---|
templateName | Image Template Name. Default is server name + timestamp. |
Lock an Instance
curl -X PUT "https://api.gomorpheus.com/api/instances/1/lock" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structure like this:
{
"success": true
}
This will lock the instance. While locked, instances may not be removed.
HTTP Request
PUT https://api.gomorpheus.com/api/instances/:id/lock
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
Unlock an Instance
curl -X PUT "https://api.gomorpheus.com/api/instances/1/unlock" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structure like this:
{
"success": true
}
This will unlock the instance.
HTTP Request
PUT https://api.gomorpheus.com/api/instances/:id/unlock
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
Get Security Groups
curl -XGET "https://api.gomorpheus.com/api/instances/1/security-groups" \
-H "Authorization: BEARER $MORPHEUS_API_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
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
Set Security Groups
curl -X POST "https://api.gomorpheus.com/api/instances/1/security-groups" \
-H "Authorization: BEARER $MORPHEUS_API_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
POST https://api.gomorpheus.com/api/instances/:id/security-groups
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
JSON Parameters
Parameter | Default | Description |
---|---|---|
securityGroupIds | List of all security groups ids which should be applied. If no security groups should apply, pass ’[]’ |
This defines the list of all the security groups applied to an instance.
Delete an Instance
curl -XDELETE "$MORPHEUS_API_URL/api/instances/1" \
-H "Authorization: BEARER $MORPHEUS_API_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
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
Query Parameters
Parameter | Default | Description |
---|---|---|
preserveVolumes | off | Preserve Volumes |
keepBackups | off | Preserve copy of backups |
releaseEIPs | on | Release EIPs |
force | off | Force Delete |
Undo Delete of an Instance
curl -XPUT "$MORPHEUS_API_URL/api/instances/2/cancel-removal" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json"
The above command returns JSON structured like getting a single instance.
This operation will undo the delete of an instance that is pending removal.
HTTP Request
PUT https://api.gomorpheus.com/api/instances/:id/cancel-removal
URL Parameters
Parameter | Description |
---|---|
:id | ID of the instance |
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.
Get All Apps
curl "$MORPHEUS_API_URL/api/apps" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"apps": [
{
"id": 1,
"name": "My Test App",
"description": "Sample Description",
"owner": {
"id": 1,
"username": "admin"
},
"account": {
"id": 1,
"name": "root"
}
"siteId": 1,
"group": {
"id": 1,
"name": "My Group"
},
"blueprint": {
"id": 135,
"name": "Grails Example",
"type": "morpheus"
},
"type": "morpheus",
"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 a paginated list of apps.
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 | Filter by name | |
phrase | Filter by wildcard search of name and description | |
createdBy | Filter by Created By (User) ID. Accepts multiple values. | |
showDeleted | false | If true, includes apps in pending removal status. |
Get a Specific App
curl "$MORPHEUS_API_URL/api/apps/4" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"app": {
"id": 1,
"name": "My Test App",
"description": "Sample Description",
"owner": {
"id": 1,
"username": "admin"
},
"tenant": {
"id": 1,
"name": "root"
}
"siteId": 1,
"group": {
"id": 1,
"name": "My Group"
},
"blueprint": {
"id": 135,
"name": "Grails Example",
"type": "morpheus"
},
"type": "morpheus",
"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
URL Parameters
Parameter | Description |
---|---|
:id | ID of the app |
Create an App
curl -XPOST "$MORPHEUS_API_URL/api/apps" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"blueprintId": "existing",
"name": "sample",
"description": "A sample app",
"group": {
"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 |
---|---|---|
blueprintId | The ID of the Blueprint. Use existing to create a blank app. |
|
name | A unique name for the app | |
group | A Map containing the id of the Group | |
description | Description | |
environment | Environment code (appContext) |
Updating an App
curl -XPUT "$MORPHEUS_API_URL/api/apps/2" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "My Sample App",
"description": "A new description of this app",
}'
The above command returns JSON structured like getting a single app.
This endpoint provides updating of some basic app settings.
HTTP Request
PUT https://api.gomorpheus.com/api/apps/:id
URL Parameters
Parameter | Description |
---|---|
:id | ID of the app |
JSON App Parameters
Parameter | Default | Description |
---|---|---|
name | Name | |
description | Description | |
environment | Environment (appContext) | |
ownerId | User ID, can be used to change app owner. This also changes the owner for each instance in the app. |
Add Existing Instance to App
curl -XPOST "$MORPHEUS_API_URL/api/apps/1/add-instance" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"instanceId": 55, tierName: "App"}'
The above command returns JSON structured like getting a single app.
HTTP Request
POST https://api.gomorpheus.com/api/apps/:id/add-instance
URL Parameters
Parameter | Description |
---|---|
:id | ID of the app |
JSON Parameters
Parameter | Default | Description |
---|---|---|
instanceId | The ID of the instance being added | |
tierName | The Name of the Tier |
Remove Instance from App
curl -XPOST "$MORPHEUS_API_URL/api/apps/1/remove-instance" \
-H "Authorization: BEARER $MORPHEUS_API_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
URL Parameters
Parameter | Description |
---|---|
:id | ID of the app |
JSON Parameters
Parameter | Default | Description |
---|---|---|
instanceId | The ID of the instance being removed |
Get Security Groups
curl -XGET "https://api.gomorpheus.com/api/apps/1/security-groups" \
-H "Authorization: BEARER $MORPHEUS_API_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
URL Parameters
Parameter | Description |
---|---|
:id | ID of the app |
Set Security Groups
curl -XPOST "$MORPHEUS_API_URL/api/apps/1/security-groups" \
-H "Authorization: BEARER $MORPHEUS_API_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
POST https://api.gomorpheus.com/api/apps/:id/security-groups
URL Parameters
Parameter | Description |
---|---|
:id | ID of the app |
JSON Parameters
Parameter | Default | Description |
---|---|---|
securityGroupIds | List of all security groups ids which should be applied. If no security groups should apply, pass ’[]’ |
Delete an App
curl -XDELETE "$MORPHEUS_API_URL/api/apps/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structure like this:
{
"success": true
}
Will delete an app.
Use removeInstances=on
to also delete the instances in the app and all associated monitors and backups.
HTTP Request
DELETE https://api.gomorpheus.com/api/apps/:id
URL Parameters
Parameter | Description |
---|---|
:id | ID of the app |
Query Parameters
Parameter | Default | Description |
---|---|---|
removeInstances | off | Remove Instances |
preserveVolumes | off | Preserve Volumes |
keepBackups | off | Preserve copy of backups |
releaseEIPs | on | Release EIPs |
force | off | Force Delete |
Undo Delete of an App
curl -XPUT "$MORPHEUS_API_URL/api/apps/2/cancel-removal" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json"
The above command returns JSON structured like getting a single app.
This operation will undo the delete of an app that is pending removal.
HTTP Request
PUT https://api.gomorpheus.com/api/apps/:id/cancel-removal
URL Parameters
Parameter | Description |
---|---|
:id | ID of the app |
Blueprints
Blueprints are templates for creating apps. They are a set of instance configurations, organized by tier, and scoped by group, cloud and environment.
A Blueprint may also be referred to as a App Template or appTemplate.
Get All Blueprints
curl "$MORPHEUS_API_URL/api/blueprints" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"blueprints": [
{
"id": 135,
"name": "test",
"type": "morpheus",
"description": null,
"category": null,
"config": {
"image": "/assets/apps/template.png",
"tiers": {
"Web": {
"linkedTiers": [
],
"tierIndex": 1,
"instances": [
{
"instance": {
"type": "nginx"
},
"groups": {
"My Group": {
"clouds": {
"My Cloud": {
"instance": {
"layout": {
"code": "nginx-vmware-1.9-single",
"id": 179
},
"name": "test-nginx-${sequence}",
"allowExisting": false,
"createUser": "on",
"type": "nginx",
"userGroup": {
"id": ""
}
},
"networkInterfaces": [
{
"ipMode": "",
"primaryInterface": true,
"network": {
"id": "",
"hasPool": false
},
"networkInterfaceTypeId": 4,
"networkInterfaceTypeIdName": "VMXNET 3"
}
],
"volumes": [
{
"vId": 255,
"controllerMountPoint": "46:0:4:0",
"size": 10,
"maxIOPS": null,
"name": "root",
"rootVolume": true,
"storageType": 1,
"datastoreId": "autoCluster",
"maxStorage": 0
}
],
"config": {
"resourcePoolId": "resgroup-123",
"createUser": true
},
"plan": {
"code": "vm-1024",
"id": 76
}
}
}
}
}
}
]
}
},
"name": "test",
"templateImage": "",
"type": "morpheus",
"config": {
"isVpcSelectable": true,
"isEC2": false
}
},
"visibility": "private",
"resourcePermission": {
"all": true,
"sites": [
]
},
"owner": {
"id": 1,
"username": "admin"
},
"tenant": {
"id": 1,
"name": "root"
}
}
],
"meta": {
"offset": 0,
"max": "1",
"size": 1,
"total": 1
}
}
This endpoint retrieves all blueprints.
HTTP Request
GET https://api.gomorpheus.com/api/blueprints
Query Parameters
Parameter | Default | Description |
---|---|---|
max | 25 | Max number of results to return |
offset | 0 | Offset of records you want to load |
name | Filter by name | |
phrase | Filter by wildcard search of name and description |
Get a Specific Blueprint
curl "$MORPHEUS_API_URL/api/blueprints/4" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"blueprint": {
"id": 135,
"name": "test",
"type": "morpheus",
"description": null,
"category": null,
"config": {
"image": "/assets/apps/template.png",
"tiers": {
"Web": {
"linkedTiers": [
],
"tierIndex": 1,
"instances": [
{
"instance": {
"type": "nginx"
},
"groups": {
"My Group": {
"clouds": {
"My Cloud": {
"instance": {
"layout": {
"code": "nginx-vmware-1.9-single",
"id": 179
},
"name": "test-nginx-${sequence}",
"allowExisting": false,
"createUser": "on",
"type": "nginx",
"userGroup": {
"id": ""
}
},
"networkInterfaces": [
{
"ipMode": "",
"primaryInterface": true,
"network": {
"id": "",
"hasPool": false
},
"networkInterfaceTypeId": 4,
"networkInterfaceTypeIdName": "VMXNET 3"
}
],
"volumes": [
{
"vId": 255,
"controllerMountPoint": "46:0:4:0",
"size": 10,
"maxIOPS": null,
"name": "root",
"rootVolume": true,
"storageType": 1,
"datastoreId": "autoCluster",
"maxStorage": 0
}
],
"config": {
"resourcePoolId": "resgroup-123",
"createUser": true
},
"plan": {
"code": "vm-1024",
"id": 76
}
}
}
}
}
}
]
}
},
"name": "test",
"templateImage": "",
"type": "morpheus",
"config": {
"isVpcSelectable": true,
"isEC2": false
}
},
"visibility": "private",
"resourcePermission": {
"all": true,
"sites": [
]
},
"owner": {
"id": 1,
"username": "admin"
},
"tenant": {
"id": 1,
"name": "root"
}
}
}
This endpoint retrieves a specific blueprint.
HTTP Request
GET https://api.gomorpheus.com/api/blueprints/:id
Create a Blueprint
curl -XPOST "$MORPHEUS_API_URL/api/blueprints" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "sample",
"description": "A sample blueprint",
"type": "morpheus",
"tiers": {
"Web": {
"linkedTiers": [
],
"tierIndex": 1,
"instances": [
{
"instance": {
"type": "nginx"
},
"groups": {
"My Group": {
"clouds": {
"My Cloud": {
"instance": {
"layout": {
"code": "nginx-vmware-1.9-single",
"id": 179
},
"name": "test-nginx-${sequence}",
"allowExisting": false,
"createUser": "on",
"type": "nginx",
"userGroup": {
"id": ""
}
},
"networkInterfaces": [
{
"ipMode": "",
"primaryInterface": true,
"network": {
"id": "",
"hasPool": false
},
"networkInterfaceTypeId": 4,
"networkInterfaceTypeIdName": "VMXNET 3"
}
],
"volumes": [
{
"vId": 255,
"controllerMountPoint": "46:0:4:0",
"size": 10,
"maxIOPS": null,
"name": "root",
"rootVolume": true,
"storageType": 1,
"datastoreId": "autoCluster",
"maxStorage": 0
}
],
"config": {
"resourcePoolId": "resgroup-123",
"createUser": true
},
"plan": {
"code": "vm-1024",
"id": 76
}
}
}
}
}
}
]
}
}
}'
The above command returns JSON structured like getting a single blueprint.
HTTP Request
POST https://api.gomorpheus.com/api/blueprints
JSON Blueprint Parameters
Parameter | Default | Description |
---|---|---|
name | A name for the blueprint | |
description | Optional description field | |
category | morpheus | Optional category field |
type | morpheus | Blueprint Type. The default is ‘morpheus’. |
tiers | A Map containing a key for each tier and all their instances. |
Blueprint Tiers Configuration
The blueprint tiers
can be structured so that instance configurations are scoped to a specific environment, group and/or cloud. The environments
key is the environment name. The groups
key is the group name. The clouds
key is the cloud name. The order of scoping must always be done in the order: environments, groups, and then clouds.
Updating a Blueprint
curl -XPUT "$MORPHEUS_API_URL/api/blueprints/2" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "sample",
"description": "A sample nginx blueprint",
"type": "morpheus",
"tiers": {
"Web": {
"linkedTiers": [
],
"tierIndex": 1,
"instances": [
{
"instance": {
"type": "nginx"
},
"groups": {
"My Group": {
"clouds": {
"My Cloud": {
"instance": {
"layout": {
"code": "nginx-vmware-1.9-single",
"id": 179
},
"name": "test-nginx-${sequence}",
"allowExisting": false,
"createUser": "on",
"type": "nginx",
"userGroup": {
"id": ""
}
},
"networkInterfaces": [
{
"ipMode": "",
"primaryInterface": true,
"network": {
"id": "",
"hasPool": false
},
"networkInterfaceTypeId": 4,
"networkInterfaceTypeIdName": "VMXNET 3"
}
],
"volumes": [
{
"vId": 255,
"controllerMountPoint": "46:0:4:0",
"size": 10,
"maxIOPS": null,
"name": "root",
"rootVolume": true,
"storageType": 1,
"datastoreId": "autoCluster",
"maxStorage": 0
}
],
"config": {
"resourcePoolId": "resgroup-123",
"createUser": true
},
"plan": {
"code": "vm-1024",
"id": 76
}
}
}
}
}
}
]
}
}
}'
The above command returns JSON structured like getting a single blueprint.
HTTP Request
PUT https://api.gomorpheus.com/api/blueprints/:id
JSON Blueprint Parameters
Same as Create.
This overwrites the entire config, so the entire blueprint config should be passed.
Update Blueprint Permissions
curl -XPOST "$MORPHEUS_API_URL/api/blueprints/1/update-permissions" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "resourcePermission": {
"all":false,
"sites": [
{"id": 1}
],
"ownerId": 1
}}'
The above command returns JSON structured like getting a single blueprint.
HTTP Request
POST https://api.gomorpheus.com/api/blueprints/:id/update-permissions
JSON Parameters
Parameter | Default | Description |
---|---|---|
resourcePermission.all | Enable access for all groups | |
resourcePermission.sites | Enable access for specific groups only | |
ownerId | User ID, can be used to change blueprint owner. |
Update Blueprint Image
curl -XPOST "$MORPHEUS_API_URL/api/blueprints/1/image" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
-F 'templateImage=@filename'
The above command returns JSON structured like getting a single blueprint.
HTTP Request
POST https://api.gomorpheus.com/api/blueprints/:id/image
Parameters
Parameter | Default | Description |
---|---|---|
templateImage | Image File png,jpg,svg |
Upload a new logo image. Expects multipart form data as the request format, not JSON.
Delete a Blueprint
curl -XDELETE "$MORPHEUS_API_URL/api/blueprints/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structure like this:
{
"success": true
}
HTTP Request
DELETE https://api.gomorpheus.com/api/blueprints/:id
Jobs
Provides API interfaces for managing jobs within Morpheus
Get All Jobs
curl "$MORPHEUS_API_URL/api/jobs" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"jobs": [
{
"id": 5,
"name": "task 2",
"type": {
"id": 3,
"name": "Task Job",
"code": "morpheus.task"
},
"task": {
"id": 2
},
"jobSummary": "echo hello",
"scheduleMode": "manual",
"status": null,
"namespace": null,
"category": null,
"description": null,
"enabled": true,
"dateCreated": "2019-11-13T19:17:50+0000",
"lastUpdated": "2019-11-13T19:17:50+0000",
"lastRun": null,
"lastResult": null,
"createdBy": {
"id": 1,
"username": "root"
},
"targetType": "server",
"targets": [
{
"id": 8,
"name": "server 1",
"targetType": "server",
"refId": 20
}
],
"customConfig": null,
"customOptions": {"hello":"world"}
}
],
"stats": {
"jobCount": 17,
"todayCount": 7,
"execCount": 17,
"execSuccess": 0,
"execSuccessRate": 0,
"execFailed": 7,
"execFailedRate": 41.17647059,
"executionsPerDay": [
0,
1,
1,
3,
2,
3,
7
]
},
"meta": {
"size": 1,
"total": 1,
"max": 25,
"offset": 0
}
}
This endpoint retrieves all jobs.
HTTP Request
GET https://api.gomorpheus.com/api/jobs
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 | Name or external ID filter, restricts query to only load jobs which contain the phrase specified | |
itemSource | Source filter, restricts query to only load jobs of specified source: [all, user, sync] |
Get a Specific Job
curl "$MORPHEUS_API_URL/api/jobs/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"job": {
"id": 14,
"name": "Task 1",
"type": {
"id": 3,
"name": "Task Job",
"code": "morpheus.task"
},
"task": {
"id": 1
},
"jobSummary": "echo hello",
"scheduleMode": "1",
"status": null,
"namespace": null,
"category": null,
"description": null,
"enabled": true,
"dateCreated": "2019-11-16T18:29:35+0000",
"lastUpdated": "2019-11-16T19:46:36+0000",
"lastRun": "2019-11-16T19:45:20+0000",
"lastResult": "error",
"createdBy": {
"id": 1,
"username": "root"
},
"targetType": "server",
"targets": [
{
"id": 35,
"name": "Server 1",
"targetType": "server",
"refId": 55
}
],
"customConfig": null,
"customOptions": {"hello":"world"}
},
"executions": {
"jobExecutions": [
{
"id": 25,
"name": "Task 1",
"process": {
"id": 181,
"accountId": 1,
"uniqueId": "6d1388d0-2482-429a-81e5-92afad192c5c",
"processType": {
"code": "serverWorkflow",
"name": "workflow"
},
"description": "Task 1",
"subType": null,
"subId": null,
"zoneId": 3,
"integrationId": null,
"instanceId": null,
"containerId": null,
"serverId": 55,
"containerName": null,
"displayName": "Server 1",
"timerCategory": "Task 1",
"timerSubCategory": "99",
"status": "failed",
"reason": null,
"percent": 100.0,
"statusEta": 180000,
"message": "unknown error",
"output": null,
"error": null,
"startDate": "2019-11-16T19:45:20+0000",
"endDate": "2019-11-16T19:46:35+0000",
"duration": 75585,
"dateCreated": "2019-11-16T19:45:20+0000",
"lastUpdated": "2019-11-16T19:46:36+0000",
"createdBy": {
"username": "root",
"displayName": "Stubby Toes"
},
"updatedBy": {
"username": "root",
"displayName": "Stubby Toes"
},
"events": [
{
"id": 23,
"processId": 166,
"accountId": 1,
"uniqueId": "8401ac1f-fc02-475d-a3ec-f61ea49e668b",
"processType": {
"code": "executeTask",
"name": "execute task"
},
"description": "echo hello",
"refType": "instance",
"refId": 3,
"subType": null,
"subId": null,
"zoneId": null,
"integrationId": null,
"instanceId": 3,
"containerId": null,
"serverId": null,
"containerName": null,
"displayName": "name",
"status": "failed",
"reason": null,
"percent": 100.0,
"statusEta": 180000,
"message": "Task Execution Failed on Attempt 1\n",
"output": null,
"error": "Task Execution Failed on Attempt 1\n",
"startDate": "2019-11-14T08:00:14+0000",
"endDate": "2019-11-14T08:00:16+0000",
"duration": 1800,
"dateCreated": "2019-11-14T08:00:14+0000",
"lastUpdated": "2019-11-14T08:00:16+0000",
"createdBy": {
"username": "root",
"displayName": "Stubby Toes"
},
"updatedBy": {
"username": "root",
"displayName": "Stubby Toes"
}
}
]
},
"job": {
"id": 14,
"name": "Task 1",
"description": null,
"type": {
"id": 3,
"code": "morpheus.task",
"name": "Task Job"
}
},
"description": null,
"dateCreated": "2019-11-16T19:45:20+0000",
"startDate": "2019-11-16T19:45:20+0000",
"endData": "2019-11-16T19:46:36+0000",
"duration": 75513,
"resultData": "{\"data\":{\"results\":[],\"processId\":181},\"errorCode\":null,\"errors\":{},\"inProgress\":false,\"msg\":\"\",\"success\":false}",
"status": "error",
"statusMessage": null
}
],
"meta": {
"size": 1,
"total": 1,
"max": 25,
"offset": 0
}
}
}
This endpoint retrieves a specific job.
HTTP Request
GET https://api.gomorpheus.com/api/jobs/:id
URL Parameters
Parameter | Description |
---|---|
id | ID of the job |
includeExecCount | Number of most recent job executions to include in response |
Create a Job
Use this command to create a job. This command requires either a task task.id
or workflow workflow.id
(not both).
curl -XPOST "$MORPHEUS_API_URL/api/jobs" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"job": {
"name": "Job 1",
"workflow": {
"id": 3
},
"targetType": "server",
"targets": [
{
"refId": 2
},
{
"refId": 3
}
],
"scheduleMode": "manual",
"customOptions":{"dbVersion":"5.7"}
}}'
The above command returns JSON Structured like this:
{
"success": true
}
HTTP Request
POST https://api.gomorpheus.com/api/jobs
JSON Parameters
Parameter | Required | Description |
---|---|---|
name | Y | Job name |
enabled | N | Use this to set enabled state, defaults to true |
task.id | Y if workflow.id not used | Use this to assign task to job. Not compatible with workflow |
workflow.id | Y if task.id not used | Use this to assign workflow to job. Not compatible with task |
targetType | Y | Target type where job will execute: appliance, instance, server |
targets | 1..n for instance or server target types | Key for targets configuration, see Targets |
scheduleMode | Y | Job execution schedule type ID or 'manual’ or 'dateTime’ |
customOptions | Map of options to be used as values in the workflow tasks. These correspond to option types. | |
customConfig | N | Job custom configuration (String in JSON format) |
dateTime | N | Date and Time to execute the job. Use UTC time in the format 2020-02-15T05:00:00Z. Required when scheduleMode is 'dateTime’. |
run | N | If true executes job |
Targets
The targets
parameter is list of targets where job will execute.
Parameter | Required | Description |
---|---|---|
refId | Y | ID for instance or server depending on target type |
Update a Job
curl -XPUT "$MORPHEUS_API_URL/api/jobs/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"job": {
"name": "Job 1",
"workflow": {
"id": 3
},
"targetType": "server",
"targets": [
{
"refId": 2
},
{
"refId": 3
}
],
"scheduleMode": "manual",
"customOptions":{"hello":"world"},
"customConfig": "{\"foo\":\"bar\"}",
"run": true
}}'
The above command returns JSON Structured like this:
{
"success": true
}
HTTP Request
PUT https://api.gomorpheus.com/api/jobs/:id
URL Parameters
Parameter | Description |
---|---|
id | ID of the job |
JSON Parameters
Parameter | Required | Description |
---|---|---|
name | N | Job name |
enabled | N | Use this to set enabled state |
task.id | N | Use this to assign task to job. Not compatible with workflow |
workflow.id | N | Use this to assign workflow to job. Not compatible with task |
targetType | N | Target type where job will execute: appliance, instance, server |
targets | N | Key for targets configuration, see Targets |
scheduleMode | Y | Job execution schedule type ID or 'manual’ or 'dateTime’ |
customOptions | Map of options to be used as values in the workflow tasks. These correspond to option types. | |
customConfig | N | Job custom configuration (String in JSON format) |
dateTime | N | Date and Time to execute the job. Use UTC time in the format 2020-02-15T05:00:00Z. Required when scheduleMode is 'dateTime’. |
run | N | If true executes job |
Execute a Job
Use this command to execute a job.
curl -XPUT "$MORPHEUS_API_URL/api/jobs/3/execute" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON Structured like this:
{
"success": true
}
HTTP Request
PUT https://api.gomorpheus.com/api/jobs/:id/execute?customConfig=%7Bfoo%3Abar%7D
URL Parameters
Parameter | Description |
---|---|
id | ID of the job |
customConfig | Optional custom config |
Delete a Job
Use this command to delete a job.
curl -XDELETE "$MORPHEUS_API_URL/api/jobs/3" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON Structured like this:
{
"success": true
}
HTTP Request
DELETE https://api.gomorpheus.com/api/jobs/:id
URL Parameters
Parameter | Description |
---|---|
id | ID of the job |
Get Job Executions
curl "$MORPHEUS_API_URL/api/job-executions" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"jobExecutions": [
{
"id": 30,
"name": "name",
"process": {
"id": 190,
"accountId": 1,
"uniqueId": "2d959a94-0db6-427d-94b0-440737e9a485",
"processType": {
"code": "serverWorkflow",
"name": "workflow"
},
"description": "name",
"subType": null,
"subId": null,
"zoneId": 3,
"integrationId": null,
"instanceId": null,
"containerId": null,
"serverId": 21,
"containerName": null,
"displayName": "cluster resource name-master",
"timerCategory": "name",
"timerSubCategory": "191",
"status": "failed",
"reason": null,
"percent": 100.0,
"statusEta": 180000,
"message": "unknown error",
"output": null,
"error": null,
"startDate": "2019-11-17T14:27:08+0000",
"endDate": "2019-11-17T14:28:23+0000",
"duration": 75584,
"dateCreated": "2019-11-17T14:27:08+0000",
"lastUpdated": "2019-11-17T14:28:23+0000",
"createdBy": {
"username": "root",
"displayName": "Stubby Toes"
},
"updatedBy": {
"username": "root",
"displayName": "Stubby Toes"
},
"events": [
]
},
"job": {
"id": 3,
"name": "name",
"description": null,
"type": {
"id": 2,
"code": "morpheus.workflow",
"name": "Workflow Job"
}
},
"description": null,
"dateCreated": "2019-11-17T14:25:52+0000",
"startDate": "2019-11-17T14:25:52+0000",
"endData": "2019-11-17T14:28:23+0000",
"duration": 151421,
"resultData": "{\"data\":{\"results\":[],\"processId\":190},\"errorCode\":null,\"errors\":{},\"inProgress\":false,\"msg\":\"\",\"success\":false}",
"status": "error",
"statusMessage": null
}
],
"meta": {
"size": 1,
"total": 29,
"max": "1",
"offset": 0
}
}
This endpoint retrieves job executions.
HTTP Request
GET https://api.gomorpheus.com/api/job-executions
Query Parameters
Parameter | Default | Description |
---|---|---|
jobId | Job ID filter, restricts query to only load executions for specified job | |
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 | Name or external ID filter, restricts query to only load job executions which contain the phrase specified |
Get a Specific Job Execution
curl "$MORPHEUS_API_URL/api/job-executions/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"jobExecution": {
"id": 26,
"name": "Task 1",
"process": {
"id": 187,
"accountId": 1,
"uniqueId": "9872270f-1a0f-4c5e-9ae8-8afb692da0fa",
"processType": {
"code": "serverWorkflow",
"name": "workflow"
},
"description": "Task 1",
"subType": null,
"subId": null,
"zoneId": 3,
"integrationId": null,
"instanceId": null,
"containerId": null,
"serverId": 55,
"containerName": null,
"displayName": "docker1",
"timerCategory": "Task 1",
"timerSubCategory": "99",
"status": "failed",
"reason": null,
"percent": 100.0,
"statusEta": 180000,
"message": "unknown error",
"output": null,
"error": null,
"startDate": "2019-11-17T08:41:48+0000",
"endDate": "2019-11-17T08:43:42+0000",
"duration": 113862,
"dateCreated": "2019-11-17T08:41:48+0000",
"lastUpdated": "2019-11-17T08:43:42+0000",
"createdBy": {
"username": "root",
"displayName": "Stubby Toes"
},
"updatedBy": {
"username": "root",
"displayName": "Stubby Toes"
},
"events": [
]
},
"job": {
"id": 14,
"name": "Task 1",
"description": null,
"type": {
"id": 3,
"code": "morpheus.task",
"name": "Task Job"
}
},
"description": null,
"dateCreated": "2019-11-17T08:41:47+0000",
"startDate": "2019-11-17T08:41:47+0000",
"endData": "2019-11-17T08:43:42+0000",
"duration": 115226,
"resultData": "{\"data\":{\"results\":[],\"processId\":187},\"errorCode\":null,\"errors\":{},\"inProgress\":false,\"msg\":\"\",\"success\":false}",
"status": "error",
"statusMessage": null
}
}
This endpoint retrieves a specific job execution.
HTTP Request
GET https://api.gomorpheus.com/api/job-executions/:id
URL Parameters
Parameter | Description |
---|---|
id | ID of the job execution |
Get a Specific Job Execution Event
curl "$MORPHEUS_API_URL/api/job-executions/1/events/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"processEvent": {
"id": 32,
"processId": 201,
"accountId": 1,
"uniqueId": "82368308-045e-40c8-ad41-faf7ecd6320e",
"processType": {
"code": "executeTask",
"name": "execute task"
},
"description": "echo goodbye",
"refType": "instance",
"refId": 3,
"subType": null,
"subId": null,
"zoneId": null,
"integrationId": null,
"instanceId": 3,
"containerId": null,
"serverId": null,
"containerName": null,
"displayName": "echo goodbye",
"status": "failed",
"reason": null,
"percent": 100.0,
"statusEta": 10568,
"message": "Task Execution Failed on Attempt 1\n",
"output": null,
"error": "Task Execution Failed on Attempt 1\n",
"startDate": "2019-11-19T08:00:25+0000",
"endDate": "2019-11-19T08:00:27+0000",
"duration": 1712,
"dateCreated": "2019-11-19T08:00:25+0000",
"lastUpdated": "2019-11-19T08:00:27+0000",
"createdBy": {
"username": "root",
"displayName": "Stubby Toes"
},
"updatedBy": {
"username": "root",
"displayName": "Stubby Toes"
}
}
}
This endpoint retrieves a specific job execution event.
HTTP Request
GET https://api.gomorpheus.com/api/job-executions/:id/events/:eventId
URL Parameters
Parameter | Description |
---|---|
id | ID of the job execution |
eventId | ID of the job execution event |
Automation
The Automation API endpoints provide the management of Tasks, Workflows, Executions, Scale Thresholds, Power and Execute Scheduling.
Tasks
Provides API interfaces for managing the creation and modification of automation tasks. Tasks are used in workflows for automation.
curl "$MORPHEUS_API_URL/api/tasks"
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"tasks": [
{
"id": 5,
"accountId": 1,
"name": "aptitude upgrade",
"taskType": {
"id": 1,
"code": "script",
"name": "Shell Script"
},
"file": {
"id": 1275,
"sourceType": "local",
"contentRef": null,
"contentPath": null,
"repository": null,
"content": "apt-get upgrade -y"
},
"taskOptions": {
}
},
],
"meta": {
"offset": 0,
"max": 25,
"size": 1,
"total": 1
}
}
This endpoint retrieves all tasks.
HTTP Request
GET https://api.gomorpheus.com/api/tasks
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 | Filter by matching name | |
name | Filter by name | |
taskTypeCodes | Filter by task type code(s). |
Get a Specific Task
curl "$MORPHEUS_API_URL/api/tasks/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"task": {
"id": 5,
"accountId": 1,
"name": "aptitude upgrade",
"taskType": {
"id": 1,
"code": "script",
"name": "Shell Script"
},
"file": {
"id": 1275,
"sourceType": "local",
"contentRef": null,
"contentPath": null,
"repository": null,
"content": "apt-get upgrade -y"
},
"taskOptions": {
}
}
}
This endpoint will retrieve a specific task by id
HTTP Request
GET https://api.gomorpheus.com/api/tasks/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the task |
Create a Task
curl -XPOST "$MORPHEUS_API_URL/api/tasks" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"task": {
"name": "cleanup tmp files",
"taskType": {
"code": "script"
},
"executeTarget": "resource",
"file": {
"sourceType": "local",
"content": "rm -rf /var/www/app1/tmp/*\nrm -rf /var/www/app2/tmp/*"
}
}}'
The above command returns JSON structured like getting a single task:
HTTP Request
POST https://api.gomorpheus.com/api/tasks
JSON Parameters
Parameter | Default | Description |
---|---|---|
name | A unique name for the task | |
code | A unique code for the task | |
taskType.code | The type of task | |
taskOptions | Map of options specific to each type. eg. script | |
resultType | The result type eg. value, exitCode, keyValue, json | |
executeTarget | The execution target. eg. local,remote,resource. The default value varies by task type. | |
retryable | false | If the task should be retried or not. |
retryCount | The number of times to retry. | |
retryDelaySeconds | The delay, between retries. | |
file | File, object specifying type and content, see File Object. This is required for task types that expect a script, having scriptable:true and an optionType of type:"file-content" . |
File Object Parameter
Parameter | Required | Description |
---|---|---|
sourceType | Y | File Source i.e. local , repository , url . Default is local . |
content | Y | File content, the script text. Only required when sourceType is local . |
contentPath | Y | Content Path, the repo file location or url. Required when sourceType is repository or url . |
contentRef | N | Content Ref, the branch/tag. Only used when sourceType is repo . |
JSON Parameters for Execute Target: Local
Parameter | Default | Description |
---|---|---|
taskOptions.localScriptGitId | The Git Repo ID | |
taskOptions.localScriptGitRef | The Git Repo Ref eg. master |
These additional task options are available when using executeTarget of local
.
JSON Parameters for Execute Target: Remote
Parameter | Default | Description |
---|---|---|
taskOptions.host | Host or IP Address for remote execution | |
taskOptions.port | 22 | Port for remote execution |
taskOptions.username | Username for remote execution | |
taskOptions.password | Password for remote execution |
These additional task options are available when using executeTarget of remote
.
Updating a Task
curl -XPUT "$MORPHEUS_API_URL/api/tasks/5" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"task":{
"name": "my task",
}}'
The above command returns JSON structured like getting a single task:
HTTP Request
PUT https://api.gomorpheus.com/api/tasks/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the task |
JSON Parameters
Same as Create.
Delete a Task
curl -XDELETE "$MORPHEUS_API_URL/api/tasks/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON Structured like this:
{
"success": true
}
HTTP Request
DELETE https://api.gomorpheus.com/api/tasks/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the task |
If a task is still tied to workflows, the delete will fail.
Execute a Task
curl -XPOST "$MORPHEUS_API_URL/api/tasks/5/execute" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"job":{
"targetType": "instance",
"instances": [1]
}}'
The above command returns JSON structured like this:
{
"success": true
}
This endpoint executes a task on the specified instances or servers. Tasks are executed asynchronously, so to see the process and event results you may fetch the job execution record. See Get a Specific Job Execution.
HTTP Request
POST https://api.gomorpheus.com/api/tasks/:id/execute
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the task |
JSON Parameters
The following parameters are passed inside an object named job
.
Parameter | Default | Description |
---|---|---|
name | (task name) | A name for the execution job. Can be used to find execution results with /api/processes?name= . |
targetType | The target context for task execution. Pass instance , server or appliance (None, execute locally on the appliance itself). This is required for tasks with executeTarget set to resource . |
|
instances | Array of Instance IDs. Only applicable for targetType is instance . |
|
servers | Array of Server IDs. Only applicable for targetType is server`. |
|
customOptions | Map of options to be used as values in the task. These correspond to option types. | |
customConfig | String of custom configuration values as JSON. |
Task Types
A Task Type is a type of automation task. Each type defines its own set of options to be configured for each task.
curl "$MORPHEUS_API_URL/api/task-types"
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"taskTypes": [
{
"id": 1,
"code": "script",
"name": "Shell Script",
"category": "script",
"description": null,
"optionTypes": [
{
"id": 254,
"name": "Script",
"code": "script",
"description": null,
"fieldName": "script",
"fieldLabel": "Script",
"fieldContext": "taskOptions",
"fieldGroup": null,
"fieldClass": null,
"fieldAddOn": null,
"placeHolder": null,
"helpBlock": null,
"defaultValue": null,
"optionSource": null,
"type": "code-editor",
"advanced": false,
"required": false,
"editable": false,
"config": {
},
"displayOrder": 5,
"wrapperClass": null,
"enabled": true,
"noBlank": null,
"dependsOnCode": null,
"contextualDefault": null
}
]
},
{
"id": 2,
"code": "sshTask",
"name": "SSH Script",
"category": "script",
"description": null,
"optionTypes": [
{
"id": 258,
"name": "Key",
"code": "sshKey",
"description": null,
"fieldName": "sshKey",
"fieldLabel": "Key",
"fieldContext": "taskOptions",
"fieldGroup": null,
"fieldClass": null,
"fieldAddOn": null,
"placeHolder": null,
"helpBlock": null,
"defaultValue": null,
"optionSource": "keyPairs",
"type": "select",
"advanced": false,
"required": false,
"editable": false,
"config": {
},
"displayOrder": 2,
"wrapperClass": null,
"enabled": true,
"noBlank": null,
"dependsOnCode": null,
"contextualDefault": null
},
{
"id": 254,
"name": "Script",
"code": "script",
"description": null,
"fieldName": "script",
"fieldLabel": "Script",
"fieldContext": "taskOptions",
"fieldGroup": null,
"fieldClass": null,
"fieldAddOn": null,
"placeHolder": null,
"helpBlock": null,
"defaultValue": null,
"optionSource": null,
"type": "code-editor",
"advanced": false,
"required": false,
"editable": false,
"config": {
},
"displayOrder": 5,
"wrapperClass": null,
"enabled": true,
"noBlank": null,
"dependsOnCode": null,
"contextualDefault": null
},
{
"id": 259,
"name": "IP Address",
"code": "host",
"description": null,
"fieldName": "host",
"fieldLabel": "IP Address",
"fieldContext": "taskOptions",
"fieldGroup": null,
"fieldClass": null,
"fieldAddOn": null,
"placeHolder": null,
"helpBlock": null,
"defaultValue": null,
"optionSource": null,
"type": "text",
"advanced": false,
"required": false,
"editable": false,
"config": {
},
"displayOrder": 0,
"wrapperClass": null,
"enabled": true,
"noBlank": null,
"dependsOnCode": null,
"contextualDefault": null
},
{
"id": 257,
"name": "Password",
"code": "password",
"description": null,
"fieldName": "password",
"fieldLabel": "Password",
"fieldContext": "taskOptions",
"fieldGroup": null,
"fieldClass": null,
"fieldAddOn": null,
"placeHolder": null,
"helpBlock": null,
"defaultValue": null,
"optionSource": null,
"type": "password",
"advanced": false,
"required": false,
"editable": false,
"config": {
},
"displayOrder": 4,
"wrapperClass": null,
"enabled": true,
"noBlank": null,
"dependsOnCode": null,
"contextualDefault": null
},
{
"id": 260,
"name": "Port",
"code": "port",
"description": null,
"fieldName": "port",
"fieldLabel": "Port",
"fieldContext": "taskOptions",
"fieldGroup": null,
"fieldClass": null,
"fieldAddOn": null,
"placeHolder": null,
"helpBlock": null,
"defaultValue": null,
"optionSource": null,
"type": "text",
"advanced": false,
"required": false,
"editable": false,
"config": {
},
"displayOrder": 1,
"wrapperClass": null,
"enabled": true,
"noBlank": null,
"dependsOnCode": null,
"contextualDefault": null
},
{
"id": 256,
"name": "Username",
"code": "username",
"description": null,
"fieldName": "username",
"fieldLabel": "Username",
"fieldContext": "taskOptions",
"fieldGroup": null,
"fieldClass": null,
"fieldAddOn": null,
"placeHolder": null,
"helpBlock": null,
"defaultValue": null,
"optionSource": null,
"type": "text",
"advanced": false,
"required": false,
"editable": false,
"config": {
},
"displayOrder": 3,
"wrapperClass": null,
"enabled": true,
"noBlank": null,
"dependsOnCode": null,
"contextualDefault": null
}
]
}
]
}
HTTP Request
GET https://api.gomorpheus.com/api/task-types
Query Parameters
Parameter | Default | Description |
---|---|---|
name | If specified will return an exact match on name or code | |
code | If specified will return an exact match on code |
Get a Specific Task Type
curl "$MORPHEUS_API_URL/api/task-types/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"success": true,
"taskType": {
"id": 1,
"code": "script",
"name": "Shell Script",
"category": "script",
"description": null,
"optionTypes": [
{
"id": 254,
"name": "Script",
"code": "script",
"description": null,
"fieldName": "script",
"fieldLabel": "Script",
"fieldContext": "taskOptions",
"fieldGroup": null,
"fieldClass": null,
"fieldAddOn": null,
"placeHolder": null,
"helpBlock": null,
"defaultValue": null,
"optionSource": null,
"type": "code-editor",
"advanced": false,
"required": false,
"editable": false,
"config": {
},
"displayOrder": 5,
"wrapperClass": null,
"enabled": true,
"noBlank": null,
"dependsOnCode": null,
"contextualDefault": null
}
]
}
}
This endpoint will retrieve a specific task type by id
HTTP Request
GET https://api.gomorpheus.com/api/task-types/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the task type |
Workflows
Provides API interfaces for managing the creation and modification of automation workflows. Workflows, also called Task Sets, are a collection of tasks that are organized in phases. A task phase determines if/when each task runs.
A Workflow may also be referred to as a Task Set or taskSet.
curl "$MORPHEUS_API_URL/api/task-sets" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"taskSets": [
{
"id": 13,
"name": "my workflow",
"description": null,
"dateCreated": "2017-06-26T15:36:19+0000",
"lastUpdated": "2017-06-26T15:44:38+0000",
"accountId": 1,
"tasks": [
8
],
"taskSetTasks": [
{
"id": 51,
"taskPhase": "provision",
"taskOrder": 2,
"task": {
"id": 8,
"name": "my task",
"taskType": {
"id": 1,
"code": "script",
"name": "Shell Script"
},
"taskOptions": {
"script": "echo \"hello\""
}
}
}
]
}
],
"meta": {
"offset": 0,
"max": 25,
"size": 1,
"total": 1
}
}
This endpoint retrieves all workflows.
HTTP Request
GET https://api.gomorpheus.com/api/task-sets
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 | Filter by matching name | |
name | Filter by name |
Get a Specific Workflow
curl "$MORPHEUS_API_URL/api/task-sets/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"taskSet": {
"id": 8,
"name": "uname",
"description": "",
"dateCreated": "2017-05-24T20:24:02+0000",
"lastUpdated": "2017-05-24T20:24:02+0000",
"accountId": 1,
"tasks": [
10
],
"taskSetTasks": [
{
"id": 33,
"taskPhase": "postProvision",
"taskOrder": 0,
"task": {
"id": 10,
"name": "uname",
"taskType": {
"id": 1,
"code": "script",
"name": "Shell Script"
},
"taskOptions": {
"script": "echo `uname a`"
}
}
}
]
}
}
This endpoint will retrieve a specific workflow by id
HTTP Request
GET https://api.gomorpheus.com/api/task-sets/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the workflow |
Create a Workflow
curl -XPOST "$MORPHEUS_API_URL/api/task-sets" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"taskSet": {
"name": "my workflow",
"tasks": [
{
"taskId": 3
},
{
"taskId": 8
},
{
"taskId": 9,
"taskPhase": "postProvision"
}
]
}}'
The above command returns JSON structured like getting a single workflow:
HTTP Request
POST https://api.gomorpheus.com/api/task-sets
JSON Parameters
Parameter | Default | Description |
---|---|---|
name | A unique name for the workflow | |
description | A description of the workflow | |
type | provision | Workflow type. Pass operation for operational workflows. |
optionTypes | [] | List of option type IDs for use with operational workflow configuration. |
tasks | [] | List of task objects in order |
tasks.taskId | Task ID | |
tasks.taskPhase | provision | Task Phase. Pass operation for operational workflows. |
Create an Operational Workflow
curl -XPOST "$MORPHEUS_API_URL/api/task-sets" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"taskSet": {
"name": "test workflow",
"type": "operation",
"optionTypes": [3,4,5],
"tasks": [
{
"taskId": 3,
"phase": "operation"
}
]
}}'
The above command returns JSON structured like getting a single workflow:
HTTP Request
POST https://api.gomorpheus.com/api/task-sets
JSON Parameters
Parameter | Default | Description |
---|---|---|
name | A unique name for the workflow | |
description | A description of the workflow | |
type | provision | Workflow type. Pass operation for operational workflows. |
optionTypes | [] | List of option type IDs for use with operational workflow configuration. |
tasks | [] | List of task objects in order |
tasks.taskId | Task ID | |
tasks.taskPhase | provision | Task Phase. Pass operation for operational workflows |
Updating a Workflow
curl -XPUT "$MORPHEUS_API_URL/api/task-sets/5" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"taskSet":{
"tasks": [
{
"taskId": 3
}
]
}}'
The above command returns JSON structured like getting a single workflow:
HTTP Request
PUT https://api.gomorpheus.com/api/task-sets/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the workflow |
JSON Parameters
Parameter | Default | Description |
---|---|---|
name | A unique name for the workflow | |
description | A description of the workflow | |
tasks | [] | List of task objects in order |
tasks.taskId | Task ID | |
tasks.taskPhase | provision | Task Phase. |
Delete a Workflow
curl -XDELETE "$MORPHEUS_API_URL/api/task-sets/1" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON Structured like this:
{
"success": true
}
HTTP Request
DELETE https://api.gomorpheus.com/api/task-sets/:id
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the workflow |
Execute a Workflow
curl -XPOST "$MORPHEUS_API_URL/api/task-sets/5/execute" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"job":{
"targetType": "instance",
"instances": [1],
"customOptions": {
"mysqlVersion":"5.7"
}
}}'
The above command returns JSON structured like this:
{
"success": true
}
This endpoint executes a workflow on the specified instances
, servers
or the appliance
itself, depending on which targetType
is specified. Workflows are executed asynchronously, so to see the process and event results you may fetch the job execution record. See Get a Specific Job Execution.
HTTP Request
POST https://api.gomorpheus.com/api/task-sets/:id/execute
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the workflow |
JSON Parameters
The following parameters are passed inside an object named job
.
Parameter | Default | Description |
---|---|---|
name | (workflow name) | A name for the execution job. Can be used to find execution results with /api/processes?name= . |
targetType | The target context for task execution. Pass instance , server or appliance (None, execute locally on the appliance itself). This is required for tasks with executeTarget set to resource . |
|
instances | Array of Instance IDs. Only applicable for targetType is instance . |
|
servers | Array of Server IDs. Only applicable for targetType is server`. |
|
customOptions | Map of options to be used as values in the workflow tasks. These correspond to option types. | |
customConfig | String of custom configuration values as JSON. |
Power Schedules
Power Schedules can be configured to automatically power on and off your instances and servers.
curl "$MORPHEUS_API_URL/api/power-schedules" \
-H "Authorization: BEARER $MORPHEUS_API_TOKEN"
The above command returns JSON structured like this:
{
"schedules": [
{
"id": 1,
"name": "weekday daytime",
"description": "weekday daytime hours",
"enabled": true,
"scheduleType": "power",
"scheduleTimezone": "America/New_York",
"sundayOn": 0.0,
"sundayOff": 0.0,
"mondayOn": 7.0,
"mondayOff": 19.0,
"tuesdayOn": 7.0,
"tuesdayOff": 19.0,
"wednesdayOn": 7.0,
"wednesdayOff": 19.0,
"thursdayOn": 7.0,
"thursdayOff": 19.0,
"fridayOn": 7.0,
"fridayOff": 19.0,
"saturdayOn": 0.0,
"saturdayOff": 0.0,
"totalMonthlyHoursSaved": 463.32,
"dateCreated": "2018-03-01T07:56:38+0000",
"lastUpdated": "2018-09-13T21:38:19+0000"
}
],
"meta": {
"size": 1,
"total": 1,
"max": 25,
"offset": 0
}
}
This endpoint retrieves all power schedules associated with the account.
HTTP Request
GET https://api.gomorpheus.com/api/power-schedules
Query Parameters
Parameter | Default | Description |
---|---|---|
name | If specified will return an exact match on name | |
phrase | If specified will return a p |