Using the REST API for databases

You can use the REST API to create and manage your database patterns, database instances, database images, database workloads, pattern types, and system plug-ins.

Note: . After successfully authentication, the server will return two cookies, zsessionid and SimpleToken, that should be included with subsequent HTTP requests that are part of the same session.

Use the accept-language header on your HTTP request to specify which supported system language should be used when generating the response data.

The following tasks can be completed using the REST API:

Database pattern type REST interface

List pattern type information

GET /resources/patternTypes/{dbaas_patterntype}/{version}
Note: The value of {dbaas_patterntype} could be dbaas, dbaas.std.oltp or dbaas.std.datamart
Table 1. List pattern type information details.
Example URL https://localhost/resources/patternTypes/dbaas/1.1  
Response content-type application/json  
Response example
{
   "status": "avail",
   "shortname": "dbaas",
   "prereqs": {
      "foundation": "2.0.0.0"
   },
   "version": "1.1",
   "builder": false,
   "name": "IBM Database Patterns",
   "description": "IBM Database Patterns",
   "url": "https://172.16.65.27:9444/storehouse/admin/patterntypes/dbaas/1.1/"
}
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

Update database pattern type

PUT /resources/patternTypes/{dbaas_patterntype}/{version_vrmf}
Note:
  • The value of {dbaas_patterntype} could be dbaas.std.oltp or dbaas.std.datamart
  • {version_vrmf} should be the format of “vrmf”, eg: 1.1.0.0
Table 2. Update database pattern type details.
Example URL https://localhost/resources/patternTypes/ dbaas.std.oltp/1.1.0.0  
Response content-type application/json  
Response example
{
  "status": "accepted"
}

Valid status includes “accepted”, “avail”, “deprecated”

“accepted” will accept the license agreement.
“avail” will enable the pattern type
“unavail” will disable the pattern type
 
Response body
{ "status": "accepted" }
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

Show list of plug-ins for a pattern type

GET /resources/patternTypes/{dbaas_patterntype}/{version}/plugins 
Note: The value of {dbaas_patterntype} could be dbaas, dbaas.std.oltp or dbaas.std.datamart
Table 3. Show list of plug-ins for a pattern type details.
Example URL https://localhost/resources/patternTypes/dbaas/1.1/plugins  
Response content-type application/json  
Response example
[
   "firewall/1.1.0.0",
   "tsm/1.1.0.0",
   "deployinlet/1.1.0.0",
   "iaas.WCA/1.1.0.0",
   "db2/1.1.0.0",
   "activator/1.1.0.0",
   "jaqlserver/1.1.0.0",
   "autoscaling/1.1.0.0",
   "troubleshooting/1.1.0.0",
   …
]
 
Response header location https://localhost/resources/applicationPatterns/a-4e21f6e9-2ca7-4a3a-a5cc-00f04f7b7f08  
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

Plug-in Configuration REST interface

Retrieve plug-in configuration information

GET /resources/plugins/{dbaas_plugin}/{version_ vrmf }/config
Table 4. Retrieve plug-in configuration information details.
Example URL https://localhost/resources/plugins/tsm/1.1.0.0/config  
Response content-type application/json  
Response example
{
   "config": {
      "parms": {
         "tcpserveraddress": "172.16.33.251",
         "tcpport": "1500",
         "adminusername": "admin",
         "db2domain": "DB2DOMAIN",
         "adminpassword": "<xor>bm1s"
      },
      "files": [
         "tsm/tsm_client-6.2.2.0-linuxx86-20110402.tgz"
      ],
      "version": "1.1.0.0",
      "patterntypes": {
         "primary": {
            "dbaas": "1.1"
         },
         "secondary": [
            {
               "webapp": "1.1"
            }
         ]
      },
      "name": "tsm",
      …
}
 
Response code 201 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  404 The Plug-in is not found.
  500 Unexpected error

Database Pattern REST interface

List all database patterns

GET /resources/applicationPatterns/?app_type=database
Table 5. List all database patterns details.
Example URL https://localhost/resources/applicationPatterns/?app_type=database  
Response content-type application/json  
Response example
[
   {
      "last_modifier": "cbadmin",
      "content_type": "application/json",
      "app_storehouse_base_url": "https://172.16.33.106:9444/storehouse/user/applications/a-4393478a-53b3-4eff-8245-340a7c232070/",
      "app_name": "db_pattern1",
      "locked": "false",
      "creator": "cbadmin",
      "create_time": "2011-09-01T01:57:02Z",
      "last_modified": "2011-09-01T01:57:26Z",
      "app_mgmtserver_url": "https://172.16.33.106:9443/services/applications/a-4393478a-53b3-4eff-8245-340a7c232070",
      "access_rights": {
         "cbadmin": "F"
      },
      "content_md5": "23AC9B1C16C7417BD6009133CA3BD50A",
      "app_type": "database",
      "app_id": "a-4393478a-53b3-4eff-8245-340a7c232070",
      "description": "Blank Database",
      "Collection": "."
   },
   ...   
]
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

Create a database pattern

POST /resources/applicationPatterns
Table 6. Create a database pattern details.
Example URL https://localhost/resources/applicationPatterns/  
Request Body Content-type Content-Type - application/json (body is the application model json file)

Content-Type - application/zip (body is a compressed file, including the application model and artifacts files)

 
Request body example
{
    "model":{
        "app_type":"database",
        "patterntype":"dbaas",
        "version":"1.1",
        "name":"dbp_default",
        "description":"",
        "nodes":[{
                "attributes":{
                    "purpose":"production",
                    "source":"defaultWorkloadStandardApproach",
                    "dbDiskSize":30,
                    "enableBLU":"false"                                      "workloadStandard":"departmental_OLTP",
                    "sqlType":"DB2",
                    "dbTerritory":"US",
                    "dbCodeset":"UTF-8",
                    "dbCollate":"SYSTEM",
                    "versionName":"V97Linux",
                    "fixpackName":"db2_hybrid_en-9.7.0.5-linuxx64-20120112.tgz"
                },
                "type":"DB2",
                "id":"database"
            }
        ]
    }
}
"app_type:" This must be “database” "patterntype:" This must be “dbaas” purpose: retrieve the value from Get resources/databaseProvisionPurposes "source:" This may be “workloadStandardApproach” “defaultworkloadStandardApproach” or “cloneApproach”
Response content-type application/json  
Response body example
{
   "content_type": "application/json",
   "last_modifier": "cbadmin",
   "create_time": "2012-05-14T01:54:48Z",
   "last_modified": "2012-05-14T01:55:53Z",
   "access_rights": {
      "cbadmin": "F"
   },
   "content_md5": "3EB002BE6EB3CE941FDE95668B283E35",
   "app_type": "database",
   "app_name": "dbp_default",
   "app_id": "a-2f6df81b-9fd3-48c7-b230-d7ea3cb1e005",
   "locked": "false",
   "creator": "cbadmin",
   "Collection": "."
}
 
Response header location https://localhost/resources/resources/applicationPatterns/a-2f6df81b-9fd3-48c7-b230-d7ea3cb1e005  
Response code 201 Created
  401 The user is not authorized to perform this action.
  403 Access forbidden
  412 Invalid parameter supplied, for example, the JSON file is invalid.
  415 Invalid content type
  500 Unexpected error

Upload a sql file for database pattern specified by Database Pattern ID

PUT /resources/applicationPatterns/{db_pattern_id}/artifacts/{filename}
Note: The file is overwritten if it already exists.
Table 7. Upload a sql file for database pattern specified by Database Pattern ID details.
Example URL https://localhost/resources/applicationPatterns/a-8f076605-2201-4461-b80c-635ccc18af1d/artifacts/test.sql  
Request content-type application/octet-stream  
Request body sql file  
Response content-type application/json  
Response body example
{
   "fileName": "test.sql",
   "file": "artifacts/test.sql",
   "file_name": "test.sql"
}
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  404 The application specified by {dbid} is not found.
  500 Unexpected error

Update a database pattern specified by Database Pattern ID

PUT /resources/applicationPatterns/{db_pattern_id}
Table 8. Update a database pattern specified by Database Pattern ID details.
Example URL https://localhost/resources/applicationPatterns/a-cdaac959-672c-4df7-a648-b333a3843422  
Request content-type and body Content-Type - application/json (body is the application model json file)

Content-Type - application/zip (body is compressed file, including the application model and artifacts files)

 
Request body example
{
"model":{
"app_type":"database",
"patterntype":"dbaas",
"version":"1.1",
"name":"db_pattern1",
"description":"",
"nodes":[{
"attributes":{
"purpose":"production",
"source":"defaultWorkloadStandardApproach",
"dbDiskSize":30,
"workloadStandard":"departmental_OLTP",
"sqlType":"DB2",
"dbTerritory":"US",
"dbCodeset":"UTF-8",
"dbCollate":"SYSTEM",
"versionName":"V97Linux",
"fixpackName":" db2_hybrid_en-9.7.0.5-linuxx64-20120112.tgz",
"dbSQLFile":"artifacts/test.sql"
},
"type":"DB2",
"id":"database"
}
]
}
}
 
Response content-type application/json  
Response body example
{
"content_type": "application/json",
"last_modifier": "cbadmin",
"create_time": "2012-05-14T01:54:48Z",
"last_modified": "2012-05-14T01:55:53Z",
"access_rights": {
"cbadmin": "F"
},
"content_md5": "3EB002BE6EB3CE941FDE95668B283E35",
"app_type": "database",
"app_name": "db_pattern1",
"app_id": "a-2f6df81b-9fd3-48c7-b230-d7ea3cb1e005",
"locked": "false",
"creator": "cbadmin",
"Collection": "."
}
 
Response code 200 OK
Note: If an application specified by {dbid} is not found, the 200 response code returns the following response: {"success": "false"})
  401 The user is not authorized to perform this action.
  403 Access forbidden
  404 The application specified by { db_pattern_id } is not found.
  412 Invalid parameter supplied, for example, the json file is invalid.
  500 Unexpected error

Update database pattern access rights for specified user name or group name

PUT /resources/applicationPatterns/{db_pattern_id}/accessRights/{name}?{user or group }
Table 9. Update database pattern access rights for specified user name or group name details.
Example URL https://localhost/resources/applicationPatterns/a-cdaac959-672c-4df7-a648-b333a3843422/accessRights/Everyone?group  
Response content type application/json  
Response example
{ "access_rights": "F"}
 
Response code 200 OK
  401 The user is not authorized to perform this action
  403 Access forbidden
  404 The application specified by {dbid} is not found.
  412 Invalid parameter supplied, for example, the json file is invalid.
  500 Unexpected error

Delete a database pattern specified by Database Pattern ID

DELETE /resources/applicationPatterns/{db_pattern_id}
Table 10. Delete a database pattern specified by Database Pattern ID details.
Example URL https://localhost/resources/applicationPatterns/a-cdaac959-672c-4df7-a648-b333a3843422  
Response content-type application/json  
Response body example
{
   "success": "true"
}
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  409 Conflict
  500 Unexpected error

Database Instance REST interface

List all databases

GET    /resources/databases
Table 11. List all databases details.
Response content-type application/json  
Response body example
[
   {
      "status": "RUNNING",
      "dbname": "db01",
      "start_time": "2011-03-11T01:52:56.752Z",
      "id": "d-481b6a1e-3771-4d1a-914e-4ad5c392166e"
   },
   {
      "status": "RUNNING",
      "dbname": "db02",
      "start_time": "2011-03-10T02:19:30.688Z",
      "id": "d-57a630bc-5f23-48ae-a525-7fbfd11d035a"
   },
   ...
]
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

Deploy a database specified by Database Pattern ID

POST /resources/applicationPatterns/{db_pattern_id}/virtualApplications
Table 12. Deploy a database specified by Database Pattern ID details.
Request content-type application/json  
Request body Deploy by cloud group:
{
	"deployment_name": "restdb",
	"cloud_group": "1",
        "ip_version": "IPv4",
        "ssh_keys":[""],
          "parameters":{
           "database.dbname":"restdb"
        }
}

Or deploy by environment profile:

{
	"deployment_name": "restdb",
	"environment_profile_id": "1",
        "cloud_group": "1",
        "ip_group": "1",
        "ssh_keys":[""],
         "parameters":{
           "database.dbname":"restdb"
        }
}
“deployment_name” is an optional parameter for virtual application name. By default, it will be the name of application.

“cloud_group” is required for deployment.

“ssh_keys” is an optional parameter for deployment.

“ip_version” is required for deployment.

“environment_profile_id” is required for deployment.

“ip_group” is required for deployment.

Response content-type application/json  
Response header location https://localhost/resources/applicationPatterns/a-bd0b540c-d285-4413-9095-cbbccc180261/virtualApplicationsd-7dadcdcc-d448-45e0-9103-1f3582aca870  
Response example
{
   "status": "LAUNCHING",
   "deployment_name": "defdb",
   "deployment_url": "https://172.16.65.62:9443/services/deployments/d-c021e8c1-3d1a-4ac4-bdf9-f7312918cc5d",
   "deployment_id": "d-c021e8c1-3d1a-4ac4-bdf9-f7312918cc5d",
   "app_type": null,
   "app_id": "a-2f6df81b-9fd3-48c7-b230-d7ea3cb1e005",
   "creator": "cbadmin",
   "instances": [
   ],
   "creator_name": "cbadmin",
   "role_error": false
}
 
Response code 201 Created
  401 The user is not authorized to perform this action.
  404 Application specified by {dbid} is not found.
  412 Precondition failed (unable to deploy, such as template)
  500 Unexpected error

Retrieve database information specified by Database ID

GET /resources/databases/{dbid}
Table 13. Retrieve database details specified by Database ID details.
Example URL https://localhost/resources/databases/d-4db8c121-58c4-400b-80da-a2e0f916d83f  
Response content-type application/json  
Response body example
{
   "port": "50000",
   "status": "RUNNING",
   "appdba": {
      "jdbcurl":   "jdbc:db2://10.102.163.32:50000/mydb:user=appdba;password=8ga0AOQ79dkk1VwCQh;";,
      "dbpassword": "8ga0AOQ79dkk1VwCQh"
   },
   "host": "10.102.163.32",
   "dbname": "mydb",
   "id": "d-4db8c121-58c4-400b-80da-a2e0f916d83f",
   "description": "test",
   "appuser": {
      "jdbcurl": "jdbc:db2://10.102.163.32:50000/mydb:user=appuser;password=NQitXSzfpcZ6L3;";,
      "dbpassword": "NQitXSzfpcZ6L3"
   },
   "disksize": 4,
   "sqlType": "DB2",
   "creator":"cbadmin"
}


For admin:
{
   "port": "50000",
   "status": "RUNNING",
   "host": "10.102.163.32",
   "dbname": "mydb",
   "id": "d-4db8c121-58c4-400b-80da-a2e0f916d83f",
   "description": "test",
   "disksize": 4,
"sqlType": "DB2",
"creator":"cbadmin"
}
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  404 Application specified by {dbid} is not found.
  500 Unexpected error

Destroy a database specified by Database ID

PUT: /resources/virtualApplications/{dbid}
Note: In request body, the values of the operation are stop and terminate.
Table 14. Destroy a database specified by Database ID details.
Example URL https://localhost/resources/virtualApplications/d-7956c64e-0fac-49f2-b04e-efbc131a4cc4  
Response content-type application/json  
Request body
{
"operation": "kill"
}
 
Response code 202 Accepted
  401 The user is not authorized to perform this action.
  403 Access forbidden
  404 Application specified by {dbid} is not found.
  409 Conflict
  412 Precondition failed (invalid operation)
  500 Unexpected error

Delete a database specified by Database ID

DELETE: /resources/virtualApplications/{dbid}
Table 15. Delete a database specified by Database ID details.
Example URL https://localhost/resources/virtualApplications/d-7956c64e-0fac-49f2-b04e-efbc131a4cc4  
Response content-type application/json  
Request body
{"success":"true"}
 
Response code 200 OK Note: If the deployment specified by {dbid } is not found, a 200 response code returns, response body: {"success": "false"}
  401 The user is not authorized to perform this action.
  403 Access forbidden
  409 Conflict (same action is already in process)
  500 Unexpected error

Database Image REST interface

List all database images

GET:   /resources/dbimages
Table 16. List all database images details.
Example URL https://172.16.65.27/resources/dbimages  
Response content-type application/json  
Response body example
[
   {
      "imagedescription": "test",
      "imagename": "myimage",
      "timestamp": "20070201194742",
      "host": "10.102.195.22",
      "dbname": "mydb",
      "id": "maunal_172.16.37.180_mydb_20110824034523.json",
      "platformtype": "x64",
      "ostype": "linux"
   },
    …
]
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

List database images by dbaasversionge

GET:   /resources/dbimages?dbaasversionge={version}
Table 17. List database images by dbaasversionge details.
Example URL https://172.16.65.27/resources/dbimages?dbaasversionge=1.0.0.2  
Response content-type application/json  
Response body example
[
   {
      "imagedescription": "test",
      "imagename": "myimage",
      "timestamp": "20070201194742",
      "host": "10.102.195.22",
      "dbname": "mydb",
      "id": "maunal_172.16.37.180_mydb_20110824034523.json",
      "platformtype": "x64",
      "ostype": "linux"
   },
    …
]
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

Create a database image specified by Database ID

Post: /resources/virtualApplications/{dbid}/operations
Note: Create a database image includes two parts: 1) create a database image manually 2) automatically create a database image
Table 18. Create a database image specified by Database ID manually details.
Request content-type application/json  
Request body
{
    "role": "database-db2.DB2",
    "type": "backup",
    "global": false,
    "parameters": {
        "imageName": "zjimage",
        "imageDescription": "zjimage1"
    },
    "script": "backup.py",
    "method": "",
    "roleType": "DB2"
   }

“imageName” is a required parameter for creating a database image

“imageDescription” is an optional parameter.

 
Response content-type application/json  
Response header location https://localhost/resources/virtualApplications/d-38751eb2-c965-4526-b4f8-3b8d5896b473/operations/o-df8f696a-24a3-41cd-9148-f29c3146ea4d  
Response body example
{
   "method": "",
   "artifacts": [
   ],
   "operationId": "o-df8f696a-24a3-41cd-9148-f29c3146ea4d",
   "global": false,
   "role": "database-db2.DB2",
   "type": "backup",
   "parameters": {
      "imageDescription": "test",
      "imageName": "image1"
   },
   "locale": "en,zh;q=0.7,en-us;q=0.3",
   "script": "backup.py",
   "result": {
      "database-db2.11305274949390.DB2": "PENDING"
   }
   }
 
Response code 201 Created
  401 The user is not authorized to perform this action.
  404 The application specified by {dbid} is not found
  412 Precondition failed (unable to deploy, such as template)
  500 Unexpected error
Table 19. Create a database image specified by Database ID automatically details.
Request content-type application/json  
Request body
{
    "role":"database-db2.DB2",
    "type":"auto-backup",
    "parameters":{
        "frequency":"daily"
    }
}
“frequency” : required parameter, the value could be daily, weekly or off
 
Response content-type application/json  
Response header location https://localhost/resources/virtualApplications/d-38751eb2-c965-4526-b4f8-3b8d5896b473/operations/o-df8f696a-24a3-41cd-9148-f29c3146ea4d  
Response body example
{
   "artifacts": [
   ],
   "global": false,
   "operation_id": "o-ed9ad4a7-101d-4625-95da-df2b4e6dc33c",
   "role": "database-db2.DB2",
   "locale": [
      "en",
      "zh"
   ],
   "parameters": {
      "frequency": "daily"
   },
   "type": "auto-backup",
   "script": "change_backup.py",
   "result": {
      "database-db2.11318932306120.DB2": "PENDING"
   }
}
 
Response code 201 Created
  401 The user is not authorized to perform this action.
  404 The application specified by {dbid} is not found
  412 Precondition failed (unable to deploy, such as template)
  500 Unexpected error

Retrieve database image information specified by Database Image ID

Get: /resources/virtualApplications/{db_imageid}
Table 20. Retrieve database image information specified by Database Image ID details.
Example URL https://localhost/resources/dbimages/maunal_172.16.37.180_mydb_20110824034523.json  
Request content-type application/json  
Request body
{
      "imagedescription": "test",
      "imagename": "myimage",
      "timestamp": "20070201194742",
      "host": "10.102.195.22",
      "dbname": "mydb",
      "id": "maunal_172.16.37.180_mydb_20110824034523.json",
      "platformtype": "x64",
      "ostype": "linux"
   }
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  404 The application specified by {db_imageid } is not found
  500 Unexpected error

Database Configuration REST interface

Change appuser/appdba password specified by Database ID

Post: /resources/virtualApplications/{dbid}/operations
Table 21. Change appuser/appdba password specified by Database ID details.
Request content-type application/json  
Request body
{
    "role": "database-db2.DB2",
    "type": "configuration",
    "global": false,
    "parameters": {
        "DB2.APPDBAPASSWORD": newpassword1",
        "DB2.APPUSERPASSWORD": newpassword2"
    },
    "script": "change.py",
    "method": "",
    "depends": [
        
    ]
   }
 
Response content-type application/json  
Response header location https://localhost/resources/virtualApplications/d-38751eb2-c965-4526-b4f8-3b8d5896b473/operations/o-d640dcfc-5339-4f37-bfd2-a67c1780e3e0  
Response example
{
   "method": "",
   "artifacts": [
   ],
   "operationId": "o-d640dcfc-5339-4f37-bfd2-a67c1780e3e0",
   "global": false,
   "role": "database-db2.DB2",
   "depends": [
   ],
   "type": "configuration",
    "parameters": {
        "DB2.APPDBAPASSWORD": newpassword1",
        "DB2.APPUSERPASSWORD": newpassword2"
    },
   "locale": "en,zh;q=0.7,en-us;q=0.3",
   "script": "change.py",
   "result": {
      "database-db2.11305181893569.DB2": "PENDING"
   }
   }
 
Response code 201 Created
  401 The user is not authorized to perform this action.
  404 The application specified by {dbid} is not found
  412 Precondition failed (unable to deploy, such as template)
  500 Unexpected error

Database Workload REST interface

Get database workload list

Get: /resources/databaseWorkloads
Table 22. Get database workload list details.
Response content-type application/json  
Request body
[
   {
      "rate": "3",
      "workload_type": "Departmental OLTP",
      "workload_file": "customized_oltp.tgz",
      "is_system": "false",
      "version": "1.1.0.0",
      "initial_disk_size": "1",
      "name": "customerized_workload",
      "description": "This is the customized workload"
},   ...
]
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

Retrieve database workload detail specified by Database Workload ID

Get: /resources/databaseWorkloads/{db_workloadid}
Table 23. Retrieve database workload detail specified by Database Workload ID details.
Response content-type application/json  
Request body
{
      "rate": "3",
      "workload_type": "Departmental OLTP",
      "workload_file": "customized_oltp.tgz",
      "is_system": "false",
      "version": "1.1.0.0",
      "initial_disk_size": "1",
      "name": "customerized_workload",
      "description": "This is the customized workload"
}
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

Database VM Logging REST interface

Get log list from a database VM specified by Database ID and Virtual Machine ID

Get:  /log/virtualApplications/{dbid} /virtualMachines/{vmid}
Table 24. Get log list from a database VM specified by Database ID and Virtual Machine ID details.
Example URL https://localhost/log/virtualApplications/d-f8ac5627-a14e-417a-a56e-7084475ab704/virtualMachines/database-db2.11315462912266  
Response content-type application/json  
Response body example
{
    "OS":["/var/log/messages",
        "/var/log/spooler",
        "/var/log/dmesg",
        "/var/log/brcm-iscsi.log",
        "/var/log/maillog",
        "/var/log/rpmpkgs",
        "/var/log/secure",
        "/var/log/cron",
        "/var/log/wtmp",
        "/var/log/yum.log",
        "/var/log/boot.log",
        "/var/log/acpid"
    ],
    "DB2":["/home/db2inst1/sqllib/log/instance.log",
        "/home/db2inst1/sqllib/db2dump/db2diag.log",
        "/home/db2inst1/sqllib/db2dump/db2inst1.nfy",
        "/home/db2inst1/sqllib/db2dump/stmmlog/stmm.0.log"
    ],
    "IWD Agent":["/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/logs/database-db2.11315462912266.AGENT/trace.log",
        "/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/logs/database-db2.11315462912266.AGENT/console.log",
        "/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/logs/database-db2.11315462912266.DB2/trace.log",
        "/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/logs/database-db2.11315462912266.DB2/console.log",
        "/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/logs/console.log.0",
        "/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/logs/database-db2.11315462912266.systemupdate/trace.log",
        "/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/logs/database-db2.11315462912266.systemupdate/console.log",
        "/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/logs/trace.log.0",
        "/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/logs/install/trace.log",
        "/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/logs/install/console.log",
        "/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/logs/database-db2.11315462912266.SSH/trace.log",
        "/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/logs/database-db2.11315462912266.SSH/console.log",
        "/0config/0config.log"
    ]
}
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

Get log content from a database VM specified by Database ID and Virtual Machine ID and Log File Path

Get:  /log/virtualApplications/{dbid} /virtualMachines/{vmid}/{logFilePath}
Table 25. Get log content from a database VM specified by Database ID and Virtual Machine ID and Log File Path details.
Example URL https://locahost/log/virtualApplications/d-f8ac5627-a14e-417a-a56e-7084475ab704/virtualMachines/database-db2.11315462912266/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/logs/database-db2.11315462912266.DB2/console.log  
Request header Range bytes=4849-484932767

(Range is used to specify the start and end position to get from the log file)

 
Response content-type text/plain  
Request body

[2011-09-08 06:59:57,572] DB2/install.py 47904813321408 pid=14758 INFO Creating and configuring a DB2 instance

[2011-09-08 06:59:57,618] DB2/install.py 47904813321408 pid=14758 ERROR not find the script:/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/scripts/DB2/workloads/departmental_OLTP/tune_OS.sh

[2011-09-08 07:00:17,967] DB2/install.py 47904813321408 pid=14758 INFO Creating and configuring a DB2 database

[2011-09-08 07:00:17,967] DB2/install.py 47904813321408 pid=14758 ERROR not find the script:/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/scripts/DB2/workloads/departmental_OLTP/tune_inst.sh

[2011-09-08 07:01:17,343] DB2/install.py 47904813321408 pid=14758 ERROR not find the script:/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/scripts/DB2/workloads/departmental_OLTP/tune_db.sh

[2011-09-08 07:01:17,343] DB2/install.py 47904813321408 pid=14758 ERROR not find the script:/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/scripts/DB2/workloads/departmental_OLTP/int_db.sh

 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

Download log content from a database VM specified by Database ID and Virtual Machine ID and Log File Path

Get:  /log/virtualApplications/{dbid} /virtualMachines/{vmid}/{logFilePath}?action=download
Table 26. Download log content from a database VM specified by Database ID and Virtual Machine ID and Log File Path details.
Example URL https://locahost/log/virtualApplications/d-f8ac5627-a14e-417a-a56e-7084475ab704/virtualMachines/database-db2.11315462912266/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/logs/database-db2.11315462912266.DB2/console.log  
Response content-type text/plain  
Response header Content-Disposition attachment; filename="_opt_IBM_WebSphere_AppServer_profiles_AppSrv01_logs_server1_native_stdout.log"  
Request body example

[2011-09-08 06:59:57,572] DB2/install.py 47904813321408 pid=14758 INFO Creating and configuring a DB2 instance

[2011-09-08 06:59:57,618] DB2/install.py 47904813321408 pid=14758 ERROR not find the script:/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/scripts/DB2/workloads/departmental_OLTP/tune_OS.sh

[2011-09-08 07:00:17,967] DB2/install.py 47904813321408 pid=14758 INFO Creating and configuring a DB2 database

[2011-09-08 07:00:17,967] DB2/install.py 47904813321408 pid=14758 ERROR not find the script:/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/scripts/DB2/workloads/departmental_OLTP/tune_inst.sh

[2011-09-08 07:01:17,343] DB2/install.py 47904813321408 pid=14758 ERROR not find the script:/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/scripts/DB2/workloads/departmental_OLTP/tune_db.sh

[2011-09-08 07:01:17,343] DB2/install.py 47904813321408 pid=14758 ERROR not find the script:/opt/IBM/maestro/agent/usr/servers/database-db2.11315462912266/scripts/DB2/workloads/departmental_OLTP/int_db.sh

 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

Customized Workload Standards REST interface

Create a customized database workload standard

POST /resources/databaseWorkloads
Table 27. Create a customized database workload standard.
Example URL https://localhost/resources/databaseWorkloads/  
Response content-type application/json  
Request body example
{
"name":"dwl1",
"description":"the first one",
"workload_type":"Departmental_OLTP",
"initial_disk_size":"1",
"rate":"3",
"is_system":"false",
"version": "1.1.0.1",
"workload_file":"customized_oltp.zip"
}

workload_type: Value must be “Departmental_OLTP” or “Dynamic Data Mart”

initial_disk_size: Value must be from 0 to 2000

rate: Value must be from 1 to 3

is_system: Value must be “false”

workload_file: File must be a compressed file and the file name cannot start with numbers or an underscore

Response example
{
   "rate": "3",
   "workload_type": "Departmental_OLTP",
   "is_system": "false",
"workload_file":"customized_oltp.zip",
   "initial_disk_size": "1",
   "version": "1.1.0.1",
   "name": "dwl1",
   "id": "a82c2322-cd9b-4419-a184-84fec9515f9d ",
   "description": "the first one"
}
 
Response header location https://localhost/resources/databaseWorkloads/a82c2322-cd9b-4419-a184-84fec9515f9d  
Response code 201 Created
  401 The user is not authorized to perform this action.
  403 Access forbidden
  412 Invalid parameter supplied, for example, the json file is invalid.
  415 Invalid content type
  500 Unexpected error

Upload a compressed file for customized database workload standard specified by Database Workload Standard ID

PUT /resources/workloadFiles/{db_workload_standard_id}?filename={filename}
Note: This step is required to create a customized workload standard. If this file already exists, performing this action will overwrite the file.
Table 28. Upload a compressed file for customized database workload standard
Example URL https://localhost/resources/workloadFiles/a82c2322-cd9b-4419-a184-84fec9515f9d?filename=customized_oltp.zip {filename} must be the same as the value of "workload_file" in the meta json file.
Request content-type application/x-zip-compressed  
Request body Compressed file  
Response content-type application/json  
Response body example
{
   "success": "true",
   "filename": "customized_oltp.zip"
}
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  404 Database workload standard specified by {db_workload_standard_id} is not found.
  500 Unexpected error

List all database workload standards

GET /resources/databaseWorkloads/
Table 29. List all database workload standards.
Example URL https://localhost/resources/databaseWorkloads/  
Response content-type application/json  
Response example
[
   {
      "rate": "3",
      "workload_type": "Departmental OLTP",
      "workload_file": "departmental_OLTP.zip",
      "is_system": "true",
      "version": "1.1.0.1",
      "initial_disk_size": "1",
      "name": "Departmental Transactional",
      "id": "departmental_OLTP",
      "description": "For databases primarily used for online transaction processing (OLTP). The database will be optimized for transactional applications."
   },
   {
      "rate": "3",
      "workload_type": "Dynamic Data Mart",
      "workload_file": "dynamic_datamart.zip",
      "is_system": "true",
      "version": "1.1.0.1",
      "initial_disk_size": "1",
      "name": "Data Mart",
      "id": "dynamic_datamart",
      "description": "For databases primarily used for data warehousing. The database will be optimized for reporting applications."
   },
   {
      "rate": "3",
      "workload_type": "Departmental OLTP",
      "workload_file": " customized_oltp.zip",
      "is_system": "false",
      "version": "1.1.0.1",
      "initial_disk_size": "1",
      "name": "dwl1",
      "id":"a82c2322-cd9b-4419-a184-84fec9515f9d ",
      "description": "the first one"
   }
]
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

Update a customized database workload standard specified by Database Workload Standard ID

Note: The two default database workload standards, Departmental Transactional and Data Mart, can not be updated.
PUT /resources/databaseWorkloads/{db_workload_standard_id}
Table 30. Update a customized database workload standard.
Example URL https://localhost/resources/databaseWorkloads/a82c2322-cd9b-4419-a184-84fec9515f9d  
Request content type application/json  
Request body example
{
   "rate": "5",
   "workload_type": "Departmental_OLTP",
   "is_system": "false",
   "initial_disk_size": "1",
   "version": "1.1.0.1",
   "name": "dwl1",
   "id": "a82c2322-cd9b-4419-a184-84fec9515f9d ",
   "description": "the first one",
   "workload_file":" customized_oltp.zip"
}

workload_type: Value must be “Departmental_OLTP” or “Dynamic Data Mart”

initial_disk_size: Value must be from 0 to 500

rate: Value must be from 1 to 3

is_system: Value must be “false”

workload_file: File must be a compressed file and the file name cannot start with numbers or an underscore

Response content type application/json  
Response body example
{
   "rate": "5",
   "workload_type": "Departmental_OLTP",
   "is_system": "false",
   "workload_file": "customized_oltp.zip",
   "initial_disk_size": "1",
   "version": "1.1.0.1",
   "name": "dwl1",
   "id": "a82c2322-cd9b-4419-a184-84fec9515f9d ",
   "description": "the first one"
}
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  404 Database workload standard specified by {db_workload_standard_id} is not found.
  412 Invalid parameter supplied, for example, the json file is invalid.
  500 Unexpected error

Download the compressed file of a customized database workload standard specified by Customized Database Workload Standard ID and compressed file name

GET /resources/dbdownloadzip/{db_workload_standard_id}/artifact/{File Name}
Table 31. Download the compressed file of a customized database workload standard.
Example URL https://locahost/resources/dbdownloadzip/a82c2322-cd9b-4419-a184-84fec9515f9d/artifact/customized_oltp.zip  
Response content type application/octet-stream  
Response body The compressed file of the customized database workload standard  
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  404 The compressed file of the customized database workload standard specified by {db_workload_standard_id} and {File Name} is not found.
  500 Unexpected error

Download the compressed file of a default database workload standard specified by default Database Workload Standard ID and compressed file name

GET /resources/downloadSysZip/{db_workload_standard_id}/artifact/{File Name}
Table 32. Download the compressed file of a default database workload standard.
Example URL https://locahost/resources/downloadSysZip/Departmental_OLTP.zip  
Response content type application/zip  
Response header Content-Disposition attachment; filename="Departmental_OLTP.zip"  
Response body The compressed file of the pre-defined database workload standard  
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

Delete a customized database workload standard specified by Customized Database Workload Standard ID

Note: The two default database workload standards, Departmental Transactional and Data Mart, can not be deleted.
DELETE /resources/databaseWorkloads/{db_workload_standard_id}
Table 33. Delete a customized database workload standard.
Example URL https://localhost/resources/ databaseWorkloads/a82c2322-cd9b-4419-a184-84fec9515f9d  
Request content type application/json  
Request body example
{
   "success": "true"
}
 
Response code 200 OK

Note: If a database workload standard specified by {db_workload_standard_id} is not found, the 200 response code returns, response body: {"success": "false"}

  401 The user is not authorized to perform this action.
  403 Access forbidden
  409 Conflict
  500 Unexpected error

User Management REST interface

Create a user

POST /resources/virtualApplications/{dbid}/operations
Table 34. Create a user.
Example URL https://localhost:port /resources/virtualApplications/d-0a70a575-4bac-420e-8c7a-e663d2448e10/operations/  
Response content-type application/json  
Request example
{"role":"database-db2.DB2",
"type":"createDB2User",
"parameters":{
"sshAccess":"Deny",
"userName":"newuser",
"password":"<xor>bm1s",
"authLevel":["SYSADM","SYSCTRL","SYSMAINT","SYSMON"]},
"groups":{}}
 
Response body example
{
   "target": "ALL",
   "artifacts": [
   ],
   "preset_status": "CONFIGURING",
   "global": false,
   "operation_id": "o-6562b92e-3a58-42d1-8601-7275543afff3",
   "rolling": false,
   "role": "database-db2.DB2",
   "locale": [
      "en",
      "zh_CN",
      "en_US"
   ],
   "parameters": {
      "userName": "newuser",
      "password": "< xor >bm1s",
      "sshAccess": "Deny",
      "authLevel": [
         "SYSADM",
         "SYSCTRL",
         "SYSMAINT",
         "SYSMON"
      ]
   },
   "type": "createDB2User",
   "script": "create_db2_user.py",
   "result": {
      "database-db2.11336320285009.DB2": "PENDING"
   }
}
 
Response code 201 Created
  401 The user is not authorized to perform this action.
  404 The application specified by {dbid} is not found
  500 Unexpected error

Change the password of a specified user

POST /resources/virtualApplications/{dbid}/operations
Note: This step is required to create a customized workload standard. If this file already exists, performing this action will overwrite the file.
Table 35. Change a password
Example URL https://localhost:port /resources/virtualApplications/d-0a70a575-4bac-420e-8c7a-e663d2448e10/operations/  
Request content-type application/json  
Request example
{"role":"database-db2.DB2","type":"resetPassword","parameters":{"userName":"newuser","newPassword":"<xor>a2pp"},"groups":{}}
 
Response body example
{
   "target": "ALL",
   "artifacts": [
   ],
   "preset_status": "CONFIGURING",
   "global": false,
   "operation_id": "o-97943167-3704-49c5-a332-2aa4bea7f6f3",
   "rolling": false,
   "role": "database-db2.DB2",
   "locale": [
      "en",
      "zh_CN",
      "en_US"
   ],
   "parameters": {
      "userName": "newuser",
      "newPassword": "<xor>a2pp"
   },
   "type": "resetPassword",
   "script": "change_user_password.py",
   "result": {
      "database-db2.11336320285009.DB2": "PENDING"
   }
}
 
Response code 201 Created
  401 The user is not authorized to perform this action.
  404 The application specified by {dbid} is not found
  500 Unexpected error

List all users for the specified database

GET /resources/dbusers?deploymentID={dbid}
Table 36. List all users.
Example URL https://localhost:port/resources/dbusers?deploymentID= d-0a70a575-4bac-420e-8c7a-e663d2448e10  
Response content-type application/json  
Response example
 [
   {
      "userName": "new1",
      "authLevel": "SYSADM",
      "sshAccess": "Deny"
   },
   {
      "userName": "new2",
      "authLevel": "",
      "sshAccess": "Deny"
   },
   {
      "userName": "user2",
      "authLevel": "SYSADM,SYSMAINT",
      "sshAccess": "Allow"
   },
   {
      "userName": "user4",
      "authLevel": "SYSADM,SYSCTRL,SYSMAINT,SYSMON",
      "sshAccess": "Allow"
   },
   {
      "userName": "newuser",
      "authLevel": "SYSADM,SYSCTRL,SYSMAINT,SYSMON",
      "sshAccess": "Deny"
   }
]
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

Delete a specified user

POST /resources/virtualApplications/{dbid}/operations
Table 37. Delete a user.
Example URL https://localhost:port/resources/virtualApplications/d-0a70a575-4bac-420e-8c7a-e663d2448e10/operations  
Request content type application/json  
Request body example
{"role":"database-db2.DB2","type":"userList","global":false,"role_type":"DB2","parameters":{"userName":"newuser"}}
 
Response body example
{
   "target": "ALL",
   "artifacts": [
   ],
   "preset_status": "CONFIGURING",
   "global": false,
   "operation_id": "o-f8d41175-99f0-4aa4-a8a7-9dbedbe2a4de",
   "rolling": false,
   "role": "database-db2.DB2",
   "locale": [
      "en",
      "zh_CN",
      "en_US"
   ],
   "parameters": {
      "userName": "newuser"
   },
   "type": "userList",
   "script": "delete_user.py",
   "result": {
      "database-db2.11336320285009.DB2": "PENDING"
   }
}
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

DB2 Fix Pack REST interface

Note: The Create, Upload and Update steps are required to create a fix pack.

Create a DB2 fix pack

POST /resources/virtualApplications/{dbid}/operations
Table 38. Create a DB2 fix pack.
Example URL https://localhost/resources/db2Fixes/  
Request content-type application/json  
Request body example
{"name":"v97fp6","description":"db2 v97fp6"}
 
Response content-type application/json  
Response body example
{
   "name": "v97fp6",
   "id": " cc0c684d-8ca4-4aa3-83e4-8436d5623a16",
   "description": "db2 v97fp6"
}
 
Response header location https://localhost/resources/db2Fixes/cc0c684d-8ca4-4aa3-83e4-8436d5623a16  
Response code 201 Created
  401 The user is not authorized to perform this action.
  403 Access forbidden
  412 Invalid parameter supplied; for example, the json file may be invalid.
  415 Invalid content type
  500 Unexpected error

Upload a package file by DB2 fix pack package name

PUT /resources/fixFiles/{packagename}
Note: If this file already exists, performing this action will overwrite the file.
Table 39. Upload a package file by name.
Example URL https://localhost/resources/fixFiles/v9.7fp6_linuxx64_server.tgz  
Request content-type application/x-compressed  
Request body The package file  
Response content-type application/json  
Response body example
{
   "fileName": "v9.7fp6_linuxx64_server.tgz",
   "file": "v9.7fp6_linuxx64_server.tgz",
   "file_name": "v9.7fp6_linuxx64_server.tgz"
} 
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

Update a package file by DB2 fix pack package name

PUT /resources/db2Fixes/{db_fixpack_id}
Table 40. Update a package file by name.
Example URL https://localhost/resources/db2Fixes/cc0c684d-8ca4-4aa3-83e4-8436d5623a16  
Request content-type application/json  
Request body example
{"name":"v97fp6","description":"db2 v97fp6","packageFile":"v9.7fp6_linuxx64_server.tgz","id":"cc0c684d-8ca4-4aa3-83e4-8436d5623a16"}
"id:" must be the same as {db2_fixpack_id} in the URL.
Response content-type application/json  
Response body example
 {
   "db2level": "9.7.0.6",
   "packageFile": "v9.7fp6_linuxx64_server.tgz",
   "platform": "linuxx64",
   "db2version": "9.7",
   "id": "cc0c684d-8ca4-4aa3-83e4-8436d5623a16",
   "name": "v97fp6",
   "description": "db2 v97fp6"
}
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  404 The db2 fixpack specified by {db2_fixpack_id} is not found.
  412 Invalid parameter supplied; for example, the json file may be invalid.
  500 Unexpected error

List all DB2 fix packs

GET /resources/db2Fixes /
Table 41. List all DB2 fix packs.
Example URL https://localhost/resources/db2Fixes/  
Request content-type application/json  
Response body example
[
   {
      "id": "25b3b7ff-dea8-4e97-8715-2a2d7a37a9a1",
      "name": "db2v97fp7",
      "description": "db2 v97fp7",
"db2level": "9.7.0.7",
      "platform": "linuxx64",
      "db2version": "9.7",
"packageFile": "v9.7fp7_linuxx64_server.tgz"
   },
   {
      "id": "cc0c684d-8ca4-4aa3-83e4-8436d5623a16",
      "name": "v97fp6",
      "description": "db2 v97fp6",
"db2level": "9.7.0.6",
      "platform": "linuxx64",
      "db2version": "9.7",
"packageFile": "v9.7fp6_linuxx64_server.tgz"
   }
]
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

List all fix packs valid for DB2 upgrade

GET /resources/db2FixesKS?forMatadata=true
Table 42. List all fix packs valid for DB2 upgrade.
Example URL https://localhost:port/resources/db2FixesKS?forMetadata=true  
Response content-type application/json  
Response body example
{
   "items": [
      {
         "value": " v9.7fp6_linuxx64_server.tgz",
         "name": " v97fp6"
      }
   ],
   "label": "name",
   "identifier": "value"
}
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

List all DB2 fix packs valid for creating a database pattern or database instance

GET /resources/db2Fixes/
Table 43. List all DB2 fix packs valid for creating a database pattern or database instance.
Example URL https://localhost/resources/db2Fixes?forUI=true  
Response content-type application/json  
Response body example
{
   "items": [
      {
         "value": "db2_hybrid_en-9.7.0.5-linuxx64-20120112.tgz",
         "platform": "linuxx64",
         "db2version": "9.7",
         "name": "DB2 Version 9.7 Fix Pack 5 for Linux"
      },
      {
         "value": "db2_hybrid_en-9.7.0.5-aix64-20120112.tgz",
         "platform": "aix64",
         "db2version": "9.7",
         "name": "DB2 Version 9.7 Fix Pack 5 for AIX"
      },
      {
         "value": "db2_hybrid_en-10.1.0.0-linuxx64-20120312.tgz",
         "platform": "linuxx64",
         "db2version": "10.1",
         "name": "DB2 Version 10.1 for Linux"
      },
      {
         "value": "db2_hybrid_en-10.1.0.0-aix64-20120312.tgz",
         "platform": "aix64",
         "db2version": "10.1",
         "name": "DB2 Version 10.1 for AIX"
      },
      {
         "value": "v9.7fp6_linuxx64_server.tgz",
         "platform": "linuxx64",
         "db2version": "9.7",
         "name": " v97fp6"
      }
   ],
   "label": "name",
   "identifier": "value"
}
 
Response code 200 OK
  401 The user is not authorized to perform this action.
  403 Access forbidden
  500 Unexpected error

Create a database pattern that uses a DB2 fix pack

POST /resources/applicationPatterns
Table 44. Create a database pattern that uses a DB2 fix pack.
Example URL https://localhost/resources/applicationPatterns/  
Request body content type Content-Type - application/json (body is the application model json file)

Content-Type - application/zip (body is a compressed file, including the application model and artifacts files)

 
Request body example
{
"model":{
"app_type":"database",
"patterntype":"dbaas",
"version":"1.1",
"name":" respattern ",
"description":"",
"nodes":[{
"attributes":{
"purpose":"production",
"source":"defaultWorkloadStandardApproach",
"dbDiskSize":30,
"enableBLU":"false"
"workloadStandard":"departmental_OLTP",
"sqlType":"DB2",
"dbTerritory":"US",
"dbCodeset":"UTF-8",
"dbCollate":"SYSTEM",
"versionName":"V97Linux",
"fixpackName":" v9.7fp6_linuxx64_server.tgz "
},
"type":"DB2",
"id":"database"

]
}
}
"app_type:" This must be “database” "patterntype:" This must be “dbaas” purpose: retrieve the value from Get resources/databaseProvisionPurposes "source:" This may be “defaultWorkloadStandardApproach" "workloadStandardApproach" or "cloneApproach”

fixpackName: Retrieve this through the "List all DB2 fix packs for creating a database pattern or database instance" operation.

Request content-type application/json  
Response body example
{
   "content_type": "application/json",
   "last_modifier": "cbadmin",
   "create_time": "2012-02-28T07:36:25Z",
   "last_modified": "2012-02-28T07:36:26Z",
   "access_rights": {
      "cbadmin": "F"
   },
   "content_md5": "397A79B87AEA58F5E814014E57CD61C0",
   "app_type": "database",
   "app_name": "respattern",
   "app_id": "a-bd0b540c-d285-4413-9095-cbbccc180261",
   "locked": "false",
   "creator": "cbadmin",
   "Collection": "."
}
 
Response header location https://localhost/resources/resources/applicationPatterns/a-bd0b540c-d285-4413-9095-cbbccc180261  
Response code 201 Created
  401 The user is not authorized to perform this action.
  403 Access forbidden
  412 Invalid parameter supplied; for example, the json file may be invalid.
  415 Invalid content type
  500 Unexpected error

Deploy a database with a database pattern that uses a DB2 fix pack

POST /resources/applicationPatterns/{db_pattern_id}/virtualApplications
Table 45. Deploy a database with a database pattern that uses a DB2 fix pack.
Request content-type application/json  
Request body example
{
    "cloud_group":"1",
    "ssh_keys":[""
    ],
    "parameters":{
        "database.dbname":"restdb"
    },
    "deployment_name":"restdb"
}
"deployment_name:" An optional parameter for database name. By default, it will be the name of database.

"cloud_group:" A required parameter for deployment.

Response content-type application/json  
Response header location https://localhost/resources/applicationPatterns/a-bd0b540c-d285-4413-9095-cbbccc180261/virtualApplicationsd-7dadcdcc-d448-45e0-9103-1f3582aca870  
Response example
{
   "status": "LAUNCHING",
   "deployment_name": "restdb",
   "deployment_url": "https://172.16.65.196:9443/services/deployments/d-7dadcdcc-d448-45e0-9103-1f3582aca870",
   "deployment_id": "d-7dadcdcc-d448-45e0-9103-1f3582aca870",
   "app_type": null,
   "app_id": "a-bd0b540c-d285-4413-9095-cbbccc180261",
   "creator": "cbadmin",
   "instances": [
   ],
   "creator_name": "cbadmin",
   "role_error": false
}
 
Response code 201 Created
  401 The user is not authorized to perform this action.
  404 The db2 fixpack specified by {db2_fixpack_id} is not found.
  412 Invalid parameter supplied; for example, the json file may be invalid.
  500 Unexpected error

Upgrade a deployed database

POST /resources/virtualApplications/{dbid}/operations
Table 46. Upgrade a deployed database.
Example URL https://localhost:port /resources/virtualApplications/d-7dadcdcc-d448-45e0-9103-1f3582aca870/operations/  
Response content-type application/json  
Request example
{"role":"database-db2.DB2","type":"applyFixpacks","parameters":{"fixpackName":"v9.7fp6_linuxx64_server.tgz"}}

fixpackName: Retrieve this through the "List all fix packs valid for DB2 upgrade" operation.
Response body example
{
   "method": "",
   "artifacts": [
   ],
   "global": false,
   "rolling": false,
   "parameters": {
      "fixpackName": " v9.7fp6_linuxx64_server.tgz "
   },
   "script": "upgrade_db2.py",
   "target": "All",
   "preset_status": "CONFIGURING",
   "operation_id": "o-bfd25639-68e6-4945-b58e-61ee06a29d13",
   "role": "database-db2.DB2",
   "type": "applyFixpacks",
   "locale": [
      "en",
      "en_US",
      "zh_CN"
   ],
   "result": {
      "database-db2.11331028257308.DB2": "PENDING"
   }
}
 
Response code 201 Created
  401 The user is not authorized to perform this action.
  404 The db2 fixpack specified by {db2_fixpack_id} is not found.
  412 Invalid parameter supplied; for example, the json file may be invalid.
  500 Unexpected error

Upgrade database application

PUT /resources/virtualApplications/{dbid}
Table 47. Upgrade database application.
Example URL https://localhost /resources/virtualApplications/d-fb6a73e7-f9a2-465f-8357-f26fd7b8a717  
Request body content type application/json  
Request body example
{"operation":"upgrade"}
 
Response body example true  
Response code 202 Accepted
  401 The user is not authorized to perform this action.
  403 Access forbidden
  404 Application specified by {dbid} is not found
  409 Conflict
  412 Invalid parameter supplied; for example, the json file may be invalid.
  500 Unexpected error

Delete a specified DB2 fix pack

DELETE /resources/db2Fixes/{db2_fixpack_id}
Table 48. Delete a specified DB2 fix pack.
Example URL https://localhost/resources/db2Fixes/cc0c684d-8ca4-4aa3-83e4-8436d5623a16  
Response content-type application/json  
Response example
{
   "success": "true"
}
 
Response code 200 OK

Note: If a db2 fixpack specified by {db2_fixpack_id} is not found, the 200 response code returns, response body: {"success": "false"})

  401 The user is not authorized to perform this action.
  404 Access forbidden
  409 Conflict
  500 Unexpected error