Operations REST API

Use these REST APIs to manage operations for virtual system instances, virtual application instances, and shared service instances.

In the URI pattern, substitute the type of instance for the {instance_type} and the ID for the instance for the {instance_id}. The following table lists the value to use for each instance type:
Table 1. Values for {instance_type}
Type of instance Value for {instance_type} Example
virtual system instance virtualSystemInstances GET /resources/virtualSystemInstances/d-65d29715-9063-436d-8593-d5218208f8aa/operations
virtual application instance virtualApplicationInstances GET /resources/virtualApplicationInstances/d-65d29715-9063-436d-8593-d5218208f8aa/operations
shared service instance sharedServiceInstances GET /resources/sharedServiceInstances/d-65d29715-9063-436d-8593-d5218208f8aa/operations

Get a list of operations for an instance

GET /resources/{instance_type}/{instance_id}/operations
Table 2. Get a list of operations for an instance
REST API information Value Description
Example URL https://localhost/resources/virtualSystemInstances/d-bcb20914-038c-485c-bcb9-75614332d5d9/operations/  
Response content-type application/json  
Request body example
[
   {
      "method": "",
      "artifacts": [
      ],
      "return_value": {
         "application-was.11305307168260.WAS": "success"
      },
      "operation_id": "o-c2bb569d-9626-40b5-8998-cfbf7ddb429d",
      "global": false,
      "active_time": "2011-05-14T11:56:28.850Z",
      "depends": [
      ],
      "parameters": {
         "WAS.propogatedOrBMTTranLifetimeTimeout": 999
      },
      "script": "change.py",
      "running_status": "COMPLETED",
      "complete_time": "2011-05-14T11:56:46.973Z",
      "submit_time": "2011-05-14T11:56:23.545Z",
      "role": "application-was.WAS",
      "type": "configuration",
      "result": "{\n   \"application-was.11305307168260.WAS\": \"SUCCESS\"\n}"
   }
]
 
Response code 200 Successful
  401 The user is not authorized to perform this action.
  403 Access forbidden
  404 The deployment that is specified by {instance_id} is not found.
  500 Unexpected error

Get the details of an operation

GET /resources/{instance_type}/{instance_id}/operations/{operation_id}
Table 3. Get the details of an operation
REST API information Value Description
Example URL https://localhost/resources/virtualSystemInstances/d-bcb20914-038c-485c-bcb9-75614332d5d9/operations/o-c2bb569d-9626-40b5-8998-cfbf7ddb429d  
Response content-type application/json  
Response example
[
   {
      "method": "",
      "artifacts": [
      ],
      "return_value": {
         "application-was.11305307168260.WAS": "success"
      },
      "operation_id": "o-c2bb569d-9626-40b5-8998-cfbf7ddb429d",
      "global": false,
      "active_time": "2011-05-14T11:56:28.850Z",
      "depends": [
      ],
      "parameters": {
         "WAS.propogatedOrBMTTranLifetimeTimeout": 999
      },
      "script": "change.py",
      "running_status": "COMPLETED",
      "complete_time": "2011-05-14T11:56:46.973Z",
      "submit_time": "2011-05-14T11:56:23.545Z",
      "role": "application-was.WAS",
      "type": "configuration",
      "result": "{\n   \"application-was.11305307168260.WAS\": \"SUCCESS\"\n}"
   }
]
 
Response code 200 Successful
  401 The user is not authorized to perform this action.
  403 Access forbidden
  404 The deployment that is specified by {instance_id} is not found.
  500 Unexpected error

Check the maintenance operation status in each iteration

GET /resources/{instance_type}/{instance_id}/operations?role=MAINTENANCE
Table 4. Check the maintenance operation status in each iteration
REST API information Value Description
Example URL http://server/resources/virtualSystemInstances/d-88cc2127-9380-4fa3-b644-899ad908a099/operations?role=MAINTENANCE  
Response header application/json  
Response body The operation status is in the result attribute. For example:
[
   {
      "role_status_retrieve": false,
      "artifacts": [
      ],
      "return_value": {
         "OS_Node_1.11399281896317.MAINTENANCE": "Successfully installed ifixes: [u'https://1xx.16.65.154:9443/services/ifixes/name/imagefix/scriptArchive.zip']",
         "OS_Node.11399281896316.MAINTENANCE": "Successfully installed ifixes: [u'https://1xx.16.65.154:9443/services/ifixes/name/imagefix/scriptArchive.zip']"
      },
      "target_role_instances": [
         "OS_Node_1.11399281896317.MAINTENANCE"
      ],
      "global": true,
      "rolling": true,
      "active_time": "2014-05-07T00:38:16.589Z",
      "parameters": {
         "MAINTENANCE.IFIXES": [
            {
               "vmtemplate": "OS_Node",
               "vmfixes": [
                  {
                     "installtype": "WCA",
                     "id": 1,
                     "name": "imagefix"
                  }
               ]
            },
            {
               "vmtemplate": "OS_Node_1",
               "vmfixes": [
                  {
                     "installtype": "WCA",
                     "id": 1,
                     "name": "imagefix"
                  }
               ]
            }
         ]
      },
      "script": "install_updates.py",
      "target": "ALL",
      "visible": true,
      "running_status": "COMPLETED",
      "preset_status": "CONFIGURING",
      "complete_time": "2014-05-07T00:39:17.614Z",
      "operation_id": "o-bbb6ea3a-4421-48c0-aaae-cb3ba1521e94",
      "submit_time": "2014-05-07T00:38:11.089Z",
      "role": "MAINTENANCE",
      "type": "fixes",
      "locale": [
         "en_US",
         "en"
      ],
      "group_id": 1,
      "rolling_config": {
         "group_size": 2
      },
      "result": "{\n   \"OS_Node_1.11399281896317.MAINTENANCE\": \"SUCCESS\",\n   \"OS_Node.11399281896316.MAINTENANCE\": \"SUCCESS\"\n}"
   }
]
 
Response code 200 OK
  403 Access forbidden
  500 Unexpected error

Get the operation metadata for an instance

GET /resources/operationMetadata/?deploymentId={deployment_id}
Table 5. Get the operation metadata for an instance
REST API information Value Description
Example URL https://localhost/resources/operationMetadata/?deploymentId=d-bcb20914-038c-485c-bcb9-75614332d5d9  
Response content-type application/json  
Response example
{
   "FIREWALL": [
      {
         "label": "Connect In",
         "attributes": [
            {
               "label": "Edit Inbound Server(s) & Port(s)",
               "type": "string",
               "id": "FIREWALL.port_server_in",
               "description": "List of Server(s) (IP or IP/netmask) & Port(s) for inbound connections"
            }
         ],
         "type": "configuration",
         "id": "addConnectIn",
         "script": "change.py changeIn",
         "description": "Add or remove Server(s) & Port(s) to be opened in the firewall",
         "pluginName": "firewall/2.0.2.0",
         "category": "Configuration"
      }, ...
   ],
   "WAS": [ 
      {
         "preset_status": "RUNNING",
         "label": "Get logs",
         "id": "getLogs",
         "script": "debug.py getLogs",
         "description": "Get logs on server.",
         "pluginName": "was/2.0.2.0",
         "category": "Troubleshooting"
      }, ...
      {
         "label": "Update configuration",
         "rolling": true,
         "id": "configuration",
         "script": "change.py",
         "description": "The operation will update the parameters under this role dynamically.",
         "rolling_config": {
            "group_size": 2
         },
         "pluginName": "was/2.0.2.0"
      }
   ],
...
}
 
Response code 200 Successful
  401 The user is not authorized to perform this action.
  403 Access forbidden
  404 The deployment that is specified by {instance_id} is not found.
  500 Unexpected error

Get the virtual roles of an instance

GET /resources/{instance_type}/{instance_id}/vmRoles
Table 6. Get the virtual roles for an instance
REST API information Value Description
Example URL https://localhost/resources/virtualSystemInstances/d-88cc2127-9380-4fa3-b644-899ad908a099/vmRoles  
Response content-type application/json  
Response example
[
   {
      "type": "WAS",
      "name": "application-was.WAS"
   },
   {
      "global": "true",
      "type": "SSH",
      "name": "SSH"
   }
]
 
Response code 200 Successful
  401 The user is not authorized to perform this action.
  403 Access forbidden
  404 The deployment that is specified by {instance_id} is not found.
  500 Unexpected error

Upload an artifact for use in an operation

PUT /resources/{instance_type}/{instance_id}/operationArtifacts/{file_name}
Table 7. Upload an artifact for use in an operation
REST API information Value Description
Example URL http://localhost/resources/virtualSystemInstances/d-9b8cd0d9-71b6-4f24-9cdf-56a35919c944/operationArtifacts/simpleWAS.war  
Request content-type application/binary  
Request example Uploaded file  
Response content-type application/json  
Response example
{
   "file_name": "simpleWAS.war",
   "file": "5490e57f-e57a-4a1e-a5fb-b2cec0ed72cf/simpleWAS.war"
}
 
Response code 200 OK
  400 Bad request
  401 The user is not authorized to perform this action.
  403 Access forbidden
  404 The deployment that is specified by {instance_id} is not found.
  500 Unexpected error

Create an operation request for an instance

POST /resources/{instance_type}/{instance_id}/operations/
Table 8. Create an operation request for an instance
REST API information Value Description
Example URL https://localhost/resources/virtualSystemInstances/d-bcb20914-038c-485c-bcb9-75614332d5d9/operations/  
Request content-type application/json  
Response header location https://localhost/resources/virtualApplications/d-bcb20914-038c-485c-bcb9-75614332d5d9/operations/  
Request example Request Body:
{  
"role":"Web_Application-was.WAS",
"type":"configuration",
"parameters": {
"WAS.ARCHIVE":"35593e24-7dc4-4034-b1b1-4870bfe3d584/ simpleWAS.war ",
"WAS.PASSWORD":"<xor>LDo+"
},
"depends": [
{
   "role": "database-db2.DB2",
   "parameters": {
      "MAXPOOLSIZE": 1000,
      "MINPOOLSIZE":50
   }
},
{
   "service": "Remote_Database",
    "parameters": {
     "key": "value" 
    }
} 
   ]
}
 
Response content-type application/json  
Response example
{
   "method": "",
   "artifacts": [
   ],
   "operation_id": "o-c2bb569d-9626-40b5-8998-cfbf7ddb429d",
   "global": false,
   "role": "application-was.WAS",
   "depends": [
{
   "role": "database-db2.DB2",
   "parameters": {
      "MAXPOOLSIZE": 1000,
      "MINPOOLSIZE":50
   },
"script":"change.py"
},
{
   "service": "Remote_Database",
    "parameters": {
     "key": "value" 
    },
"script":"change.py"
} 
   ],
   "type": "configuration",
   "parameters": {
   "WAS.ARCHIVE":"35593e24-7dc4-4034-b1b1-4870bfe3d584/ simpleWAS.war ",
   "WAS.PASSWORD":"<xor>LDo+"
   },
   "script": "change.py",
   "result": {
      "application-was.11305307168260.WAS": "PENDING"
   }
}
 
Response code 201 Created successfully
  400 Bad request
  401 The user is not authorized to perform this action.
  403 Access forbidden
  404 The deployment that is specified by {instance_id} is not found.
  500 Unexpected error
One way that you can use this API is to submit a maintenance operation to apply an interim fix or fix pack:
  • If the operation is used to apply an interim fix, include the list of interim fixes for each vm-template in the parameters attribute:
    {"role":"MAINTENANCE",
     "type":"fixes",
     "parameters":{"MAINTENANCE.IFIXES":[
        {"vmtemplate":"OS_Node",
         "vmfixes":[
              {"id":1,"name":"imagefix","installtype":"WCA"}]},
        {"vmtemplate":"OS_Node_1",
         "vmfixes":[
              {"id":1,"name":"imagefix","installtype":"WCA"}]}]}} 
  • If the operation is used to apply a fix pack, include the list of fix packs for each vm-template in the parameters attribute:
    {"role":"MAINTENANCE",
     "type":"configuration",
     "parameters":{"MAINTENANCE.FIXPACKS":
          {"OS_Node":{"IBM WebSphere Application Server":{"version":"8.5.0.1","fixpack":{"requireInstall":false}}},
           "OS_Node_1":{"DB2":{"version":"10.1.0.3","fixpack":{"binaryUrl":"vsys/db2/v10.1fp3_linuxx64_server.tar.gz"}}}}}} 
The current execution status is returned in the result attribute in the response for the operation, as shown in the following example:
{
   "role_status_retrieve": false,
   "artifacts": [
   ],
   "global": true,
   "rolling": true,
   "parameters": {
      "MAINTENANCE.IFIXES": [
         {
            "vmtemplate": "OS_Node",
            "vmfixes": [
               {
                  "installtype": "WCA",
                  "id": 1,
                  "name": "imagefix"
               }
            ]
         },
         {
            "vmtemplate": "OS_Node_1",
            "vmfixes": [
               {
                  "installtype": "WCA",
                  "id": 1,
                  "name": "imagefix"
               }
            ]
         }
      ]
   },
   "script": "install_updates.py",
   "target": "ALL",
   "preset_status": "CONFIGURING",
   "visible": true,
   "operation_id": "o-bbb6ea3a-4421-48c0-aaae-cb3ba1521e94",
   "role": "MAINTENANCE",
   "type": "configuration",
   "locale": [
      "en_US",
      "en"
   ],
   "id": "fixes",
   "rolling_config": {
      "group_size": 2
   },
   "result": {
      "OS_Node_1.11399281896317.MAINTENANCE": "PENDING",
      "OS_Node.11399281896316.MAINTENANCE": "PENDING"
   }
}

Another way that you can use this API is to start a scaling operation:

For a horizontal scale out operation, include "type" : "scaleOut" in the request body:
{
    "role": "OS_Node.OS_Node-Image",
    "type": "scaleOut",
    "parameters": {
        "instanceCount": 1,
        "lockTime": 0
    },
}
For a scale in operation, include "type" : "scaleIn" in the request body:
{
    "role": "OS_Node.OS_Node-Image",
    "type": "scaleIn",
    "parameters": {},
}
During a scale in operation, one virtual machine is removed at a time. No parameter is needed.
For a vertical scale operation for the processor, include "type" : "resetCPU" in the request body:
{
    "role": "OS_Node.OS_Node-Image",
    "type": "resetCPU",
    "parameters": {
        "cpuCount": 3,
    },
}
For a vertical scale operation for the memory, include "type" : "resetMemory" in the request body:
{
    "role": "OS_Node.OS_Node-Image",
    "type": "resetMemory",
    "parameters": {
        "memorySize": 5120,
    },
}

To determine the value of the role parameter, go to the Operations page for the instance, which you can access by selecting the instance on the Instances page and clicking Manage, and look in the value that corresponds to Image in the list of operations.

Delete an operation

DELETE /resources/{instance_type}/{instance_id}/operations/{operation_id}
Table 9. Delete an operation
REST API information Value Description
Example URL https://localhost/resources/virtualSystemInstances/d-88cc2127-9380-4fa3-b644-899ad908a099/operations/o-c2bb569d-9626-40b5-8998-cfbf7ddb429d  
Response content-type application/json  
Response example
{
   "command": "delete",
   "result": "success"
}
 
Response code 200 Successful
  401 The user is not authorized to perform this action.
  403 Access forbidden
  404 The deployment that is specified by {instance_id} is not found.
  500 Unexpected error