Welcome to ITA Automation API’s documentation¶
Introduce¶
The topics in this section discuss the ITA Automation RESTful API. The following topics are included:
The API is a RESTful web service; that is, it conforms to the architectural principles of Representational State Transfer (REST). Its RESTful architecture features a straightforward, easy-to-use interface facilitated by standard HTTP request and response messages that carry JSON format payloads.
Contents¶
JSON¶
The body of an HTTP request or response message is a document written in JavaScript Object Notation (JSON), which is a lightweight, text-based data interchange format. Although it has its roots in JavaScript, JSON is language independent and uses simple data structures. You can learn more about JSON and find JSON parsers for many languages at .. JSON.org: http://json.org . JSON parsers provide serialization and deserialization methods that make encoding and decoding the messages easier.
Elements of JSON documents¶
- A JSON document represents one serialized object or array that is delineated as follows:
- An object is a comma-separated series of name-value pairs enclosed in braces.
- An array is a comma-separated series of values enclosed in brackets.
- JSON documents conform to the following rules:
- A name-value pair consists of a name enclosed in quotation marks separated from the corresponding value by a colon. For example, “identifier” : 25 is a name-value pair. Whitespace between the name and value is insignificant.
- A value can be a string, a number, an array, an object, or one of the following literal values: true, false, or null.
- Strings must be enclosed in quotation marks.
- Objects and arrays can be nested.
API Reference¶
Common¶
HTTP Request Header
Request Header Value St2-Api-Key Y2YyYWJkOGFkNDgxYTdiZDI0ZDdjNzU1NmE0NzA2ZWJiYTBlNTE5YmJlOTg1ODU0MzNmNjc3MzcxNDE0MDFhZA content-type application/json [NOTE] ask your system administrator for St2-Api-Key value for specific ITA deploay instance
API are all Async, unblock calls, which will return right away with task ID
Use task ID to query task status via HTTP GET, for instance
curl -k -H "St2-Api-Key: Y2YyYWJkOGFkNDgxYTdiZDI0ZDdjNzU1NmE0NzA2ZWJiYTBlNTE5YmJlOTg1ODU0MzNmNjc3MzcxNDE0MDFhZA" -H "content-type: application/json" https://192.168.1.212/api/executions/56a53236b29f785a86436d0c
SSH Adapter API¶
- Request Header, see here
- Request Method: POST
- Request URL:
https://{IPAddress}/api/executions
- Request Body
{
"action":"core.remote",
"parameters": {
"username":"root",
"password":"root",
"cmd":"df -h",
"timeout": 30,
"hosts":"192.168.1.212"
}
}
Parameters
username username to login to target system password password to login to target system cmd username to login to target system timeout connection timeout in seconds hosts hosts seperated by commas
Local Commandline API¶
- Request Header, see here
- Request Method: POST
- Request URL:
https://{IPAddress}/api/executions
- Request Body
{
"action":"core.local",
"parameters": {
"cmd":"df -h",
"timeout": 30,
}
}
Parameters
cmd username to login to target system timeout connection timeout in seconds
HPSA rosh API¶
HPSA rosh API run remote command on target via HP Server Automation(HPSA) rosh utility, for details about rosh and HPSA, please refer to HPSA officiall document.
- Request Header, see here
- Request Method: POST
- Request URL:
https://{IPAddress}/api/executions
- Request Body
{
"action":"hpsa.rosh_py",
"parameters": {
"run_as_username": "root",
"target_hostname": "vm001",
"run_command": "df -h",
"connection_timeout": 30
}
}
Parameters
run_as username user name to run remote command target_hostname target server run_command command to run on target server connection_timeout connection timeout to ogfs server