执行动作


该API将用于执行Applications Manager中配置的动作。动作员只能执行与其关联的动作。

语法

XML响应API:

http://[ APM Host ]:[ APM Port ]/AppManager/xml/ExecuteAction?apikey=[ API Key ]&ActionId=10000056

JSON响应的API:

http://[ APM Host ]:[ APM Port ]/AppManager/json/ExecuteAction?apikey=[ API Key ]&ActionId=10000056

请求参数

字段 描述
ActionId 此值指定动作ID,并帮助API执行相应的动作。

示例请求

XML 输入:

http://apm-prod1:9090/AppManager/xml/ExecuteAction?apikey=c4e547c2330e2eb92d3e7af2262da9e9&ActionId=10000056

XML 响应:

<AppManager-response uri="/AppManager/xml/ExecuteAction">
<result>
<response response-code="4000">
<ExecuteAction ActionTypeID="2" Status="Success" ActionExecPath="/common/executeSMS.do?method=testAction&actionID=10000004" Message="The action test1 has been successfully executed" ActionName="test1" ActionID="10000004" ActionType="SMS Action(s)"/>
</response>
</result>
</AppManager-response>

JSON 输入:

http://apm-prod1:9090/AppManager/json/ExecuteAction?apikey=c4e547c2330e2eb92d3e7af2262da9e9&ActionId=10000056

JSON 响应:

{"response-code":"4000","response":{"uri":"/AppManager/json/ExecuteAction","result":[{"ActionTypeID":"1","Status":"Success","ActionExecPath":"/common/executeAction.do?method=testAction&actionID=20000003","Message":"The action alert_mail has been successfully executed","ActionName":"alert_mail","ActionID":"20000003","ActionType":"E-mail Action(s)"}]}}

注意: 对于诸如Ec2Instance / VMActions / Service之类的动作,动作(启动/停止/重新启动)将直接执行该动作,而在界面中,我们要求用户发送测试邮件或执行该动作。