Action functions
The following sections detail the REST API commands you can use to perform functions with BMC Database Automation (BDA) Actions.
Base URL for the API is:
https://ManagerHostName/bda/rest/api
Actions List
Returns a list of available Actions
Syntax
/1.0/actions
Method
GET
Required parameters
None
Optional parameters
scope
—Return Actions within a specific scope. Available scopes:- application
- application_instance
- db2_database
- db2_instance
- MSSQL_AvGrp
- mssql_database
- mssql_instance
- mssql_member_instance
- node
- oracle_database
- oracle_db_instance
- oracle_home
- oracle_pluggable_database
- sybase_dataserver
- sybase_dataserver_instance
- sybase_repserver
- sybase_repserver_instance
Response
{
"status": "success",
"status_code": "200",
"data": {
"actions": [
{
"id": "6",
"name": "AppInstAction",
"fq_name": "/AppInstAction",
"description": "Simple App Instance action",
"container": "/",
"scope": "application_instance",
"last_updated_by": "sysadmin",
"last_updated_date": "12-30-2015 03:49:19",
"last_run_date": {},
"user_can_run": "true"
},
{
...
},
...
]
}
}
Examples
To get a list of all available Actions:
curl -k -H "x-auth-token: b4c37d824039a5f87244e17ba0d1df05" https://my.bda.manager.com/bda/rest/api/1.0/actions
To get a list of all node-scoped Actions:
curl -k -H "x-auth-token: b4c37d824039a5f87244e17ba0d1df05" https://my.bda.manager.com/bda/rest/api/1.0/actions?scope=node
Actions Information
Returns information about a specific Action
Syntax
/1.0/actions/{action_id}
Method
GET
Required parameters
None
Optional parameters
None
Response
{
"status": "success",
"status_code": "200",
"data": {
"id": "6",
"name": "AppInstAction",
"fq_name": "/AppInstAction",
"description": "Simple App Instance action",
"container": "/",
"scope": "application_instance",
"last_updated_by": "sysadmin",
"last_updated_date": "12-30-2015 03:49:19",
"last_run_date": {},
"user_can_run": "true",
"available_to" : [
"/TEST"
]
}
}
Example
To get a list of Actions with id=5:
curl -k -H "x-auth-token: b4c37d824039a5f87244e17ba0d1df05" https://my.bda.manager.com/bda/rest/api/1.0/actions/5
Actions Template List
Returns a list of templates for a specific Action
Syntax
/1.0/actions/{action_id}/templates
Method
GET
Required parameters
None
Optional parameters
None
Response
{
"status": "success",
"status_code": "200",
"data": {
"templates": [
"template.xml",
"template1.xml",
"template3.xml"
]
}
}
Example
To get a list of template candidates for an Action with id=4:
curl -k -H "x-auth-token: b4c37d824039a5f87244e17ba0d1df05" https://my.bda.manager.com/bda/rest/api/1.0/actions/4/templates
Actions Candidates List
Returns a list of objects for a specific Action to run on
Syntax
/1.0/actions/{action_id}/candidates
Method
GET
Required parameters
None
Optional parameters
None
Response
{
"status": "success",
"status_code": "200",
"data": {
"candidates": [
{
"details":
{
"Hostname": "/rh5-si-307.gridapp-dev.com/mysqld4",
"IP Address: "172.19.26.120"
},
"fq_d": "/9e5ccae3a07e4883/mysqld4"
},
{
"details":
{
"Hostname": "/rh5-si-306.gridapp-dev.com/mysqld5",
"IP Address: "173.19.25.122"
},
"fq_d": "/9e5ccae3a07e4883/mysqld5"
},
]
}
}
Example
To get a list of candidates for an Action with id=4:
curl -k -H "x-auth-token: b4c37d824039a5f87244e17ba0d1df05" https://my.bda.manager.com/bda/rest/api/1.0/actions/4/candidates
Run Action
Runs a specific Action for a list of candidates using a specified template
Syntax
/1.0/actions/{action_id}/run
Method
POST
Required parameters
template
—Action template. List of available action templates that can be obtained using a templates REST API call.candidates
—A comma-separated list of object candidates.
Optional parameters
NEW IN 8.9.03
skip_verification
—Whether to run the Action without having first run the pre-verification steps. Valid values are true and false (default).continue_on_error
—Whether to allow serial activities to continue to run in the event of a failure. Valid values are true and false (default).execution_sequence
—Whether to run multiple Actions in a parellel manner or a serial manner. Valid values are parellel and serial.parallel
—Runs the Action in parallel across nodes containing the selected candidates, with activities on each node running in serial. Candidates that share a dependency (that is, are on
the same host) would revert to running in serial.serial
—Runs the Action to completion on one candidate at a time.
rescan_nodes_on_completion
—Whether to scan the nodes after the Action has completed. Valid values are true and false (default).cleanup_agent_logs
—Whether to automatically remove logs that are generated by BMC Database Automation on the Agent after the job is complete. Valid valees are true and false (default).override_values
—Values to override the custom field values in the supplied Action template. If the custom fields are defined as required in the template and you have not provided the default values in the template, then it is mandatory to provide the values here.
Response
{
"status": "success",
"status_code": "200",
"data": {
"job_id": "788",
"result": "Action '3' executed successfully."
}
}
Examples
To run an Action with id=4 using template default1.xml and candidate /9e5ccae3a07e4883:
curl -k -H "x-auth-token: b4c37d824039a5f87244e17ba0d1df05" --data "template=default1.xml&candidates=/9e5ccae3a07e4883" https://my.bda.manager.com/bda/rest/api/1.0/actions/4/run
To run an Action with id=4 using template default1.xml and candidates /PROD_DB/^9e5ccae3a07e4883 and /DEV_DB/^5a2dcee3307e5332:
curl -k -H "x-auth-token: b4c37d824039a5f87244e17ba0d1df05" --data "template=default1.xml&candidates=/PROD_DB/^9e5ccae3a07e4883,/DEV_DB/^5a2dcee3307e5332" https://my.bda.manager.com/bda/rest/api/1.0/actions/4/run
To run an Action with id=3 using template basic.xml and candidate /f50a9139f6a9012f/TESTSB/^f50a9139f6a9012f to override values in the template with the supplied values through custom fields:
curl -k -H "x-auth-token: 272d958e4dbf5fa5b48be172e2c87a04" --data "template=basic.xml" --data "skip_verification=false" --data "continue_on_error=true" --data "execution_sequence=serial" --data "rescan_nodes_on_completion=true" --data "cleanup_agent_logs=true" --data "candidates=/f50a9139f6a9012f/TESTSB/^f50a9139f6a9012f" --data "override_values=Custom_1=Smith,Custom_2=Jones" https://my.bda.manager.com/bda/rest/api/1.0/actions/3/run
Comments
Log in or register to comment.