
# 运行流并查看运行记录
#### 场景描述
本章节指导用户通过API运行一个流，并查询流的运行记录。API的调用方法请参见[如何调用API](https://support.huaweicloud.com/api-mssi/mssi_03_0061.html)。
#### 约束限制
无。
#### 涉及接口
运行流并查看运行历史记录涉及以下接口：
- [1.a]
- [2.a]
 
#### 操作步骤
1. 提交一个流并查看响应信息。 
   1. 运行流。
      - 接口相关信息 URI格式：POST /v1/{project_id}/flows/{flow_id}/run
        参数说明请参见[提交运行流](https://support.huaweicloud.com/api-mssi/ExecuteFlow.html)。
        
      
      - 请求示例
        ```
        POST http://{endpoint}/v1/f00ca7a36e************6d6c5f8da8/flows/cfdcacae-a44f-4827-8ad9-db47ad2a8b41/run
        {
            "run_mode": "manual",
            "input": {},
            "trigger_timing": "editFlow"
        }
        ```
        {endpoint}为"mssi.cn-north-4.myhuaweicloud.com"。
        
      
      - 响应示例
        ```
        {
            "running_id": "d96ba061-3caf-49cb-8950-4dac97a8f082",
            "flow_id": "cfdcacae-a44f-4827-8ad9-db47ad2a8b41",
            "success": true,
            "flow_name": "遍历集合元素测试",
            "message": ""
        }
        ```
        
       
   
   2. 从上述响应数据中，记录流运行的running_id。
   
   
   
   
2. 查看流运行记录。 
   1. 查询流某次运行记录。
      - 接口相关信息 URI格式：GET /v2/{project_id}/flows/{flow_id}/running-history/{running_id}
        参数说明请参见[查询单个流运行历史记录](https://support.huaweicloud.com/api-mssi/ShowSingleFlowRunningHistory.html)。
        
      
      - 请求示例
        ```
        GET http://{endpoint}/v2/f00ca7a36e***********6d6c5f8da8/flows/cfdcacae-a44f-4827-8ad9-db47ad2a8b41/running-history/d96ba061-3caf-49cb-8950-4dac97a8f082
        ```
        {endpoint}为"mssi.cn-north-4.myhuaweicloud.com"。
        
      
      - 响应示例
        ```
        {
            "id":"d96ba061-3caf-49cb-8950-4dac97a8f082",
            "flow_id":"cfdcacae-a44f-4827-8ad9-db47ad2a8b41",
            "flow_name":"遍历集合元素测试",
            "run_model":"manual",
            "status":"success",
            "icon":"https://connector-icon.obs.cn-north-7.ulanqab.huawei.com/icon/c9710579264845c6a5339fd738e66fd6/155e6930bdb24d9d95b5d3c636e133eb.png",
            "start_time":1655881122470,
            "end_time":1655881126839,
            "exec_time":4369,
            "message":null,
            "steps":[
                {
                    "stepId":"05778538-83a6-467b-bb92-738d9049bb3c",
                    "actionName":"手动触发器触发事件",
                    "actionType":null,
                    "call":{
                        "connectorRef":"ManualTrigger",
                        "triggerRef":{
                            "refName":"手动触发器触发事件",
                            "refId":"ManualTrigger",
                            "type":"instant",
                            "authentication":{
                                "connectionId":null,
                                "schema":null
                            },
                            "input":{
                                "body":{
                                }
                            },
                            "config":null,
                            "customFunctionMap":null
                        },
                        "actionRef":null,
                        "connectorVersion":"1"
                    },
                    "transmit":[
                        "bc744b98-007f-496e-bd10-ed460548f7de"
                    ],
                    "icon":"https://connector-icon.obs.cn-north-7.ulanqab.huawei.com/icon/c9710579264845c6a5339fd738e66fd6/155e6930bdb24d9d95b5d3c636e133eb.png",
                    "name":"手动触发流",
                    "lastRunningStatus":"success",
                    "cost":354
                }
            ]
        }
        ```
        
       
   
   
   
   
 
