文档

GetWorkFlow - 获取工作流详情和依赖关系

更新时间:
一键部署

获取工作流信息。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

当前API暂无授权信息透出。

请求参数

名称类型必填描述示例值
RegionIdstring

地域

public
Namespacestring

命名空间 ID

4a06d5ea-f576-4326-842c-fb14ea043d8d
NamespaceSourcestring

命名空间来源

source
GroupIdstring

应用分组 ID

hxm.test
WorkflowIdlong

工作流 ID

1234

返回参数

名称类型描述示例值
object

Schema of Response

RequestIdstring

请求 ID

45678xxx
Codeinteger

错误码

200
Messagestring

错误信息

workflow is not existed
Successboolean

结果

true
Dataobject

工作流的数据

WorkFlowInfoobject

工作流基本信息

WorkflowIdlong

工作流 ID

1234xxx
Namestring

工作流名称

workflow_111
Descriptionstring

工作流描述

my first workflow
Statusstring

工作流状态

成功
TimeTypestring

工作流时间类型

cron
TimeExpressionstring

工作流时间表达式

0 0 2 * * ?
WorkFlowNodeInfoobject

工作流节点信息

Nodesarray<object>

工作流节点列表

object
Idlong

任务 ID

123456xxx
Labelstring

任务名称

job_111
Statusinteger

任务状态

1
Edgesarray<object>

工作流边列表

object
Sourcelong

起始任务 ID

100
Targetlong

目的任务 ID

200

示例

正常返回示例

JSON格式

{
  "RequestId": "45678xxx",
  "Code": 200,
  "Message": "workflow is not existed",
  "Success": true,
  "Data": {
    "WorkFlowInfo": {
      "WorkflowId": 0,
      "Name": "workflow_111",
      "Description": "my first workflow",
      "Status": "成功",
      "TimeType": "cron",
      "TimeExpression": "0 0 2 * * ?"
    },
    "WorkFlowNodeInfo": {
      "Nodes": [
        {
          "Id": 0,
          "Label": "job_111",
          "Status": 1
        }
      ],
      "Edges": [
        {
          "Source": 100,
          "Target": 200
        }
      ]
    }
  }
}

错误码

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
2022-12-26OpenAPI 描述信息更新查看变更详情
2021-12-21OpenAPI 返回结构发生变更查看变更详情
2021-12-20新增 OpenAPI查看变更详情

示例 Demo

package com.alibaba.schedulerx.pop;

import com.alibaba.schedulerx.common.util.JsonUtil;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.schedulerx2.model.v20190430.GetWorkFlowRequest;
import com.aliyuncs.schedulerx2.model.v20190430.GetWorkFlowResponse;

public class TestGetWorkFlow {

    public static void main(String[] args) {
     // OpenAPI 的接入点,具体请查看支持地域列表或根据购买地域填写
        String regionId = "public";
      //鉴权使用的 AccessKey ID,由阿里云官网控制台获取
        String accessKeyId = "xxxxxxx";
        //鉴权使用的 AccessKey Secret,由阿里云官网控制台获取
        String accessKeySecret = "xxxxxxxxx";
        //产品名称
        String productName ="schedulerx2";
        //对照支持地域列表选择 Domain 填写
        String domain ="schedulerx.aliyuncs.com";
        //构建 OpenAPI 客户端
        DefaultProfile.addEndpoint(regionId, productName, domain);
        DefaultProfile defaultProfile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
        DefaultAcsClient client = new DefaultAcsClient(defaultProfile);
        
        GetWorkFlowRequest request = new GetWorkFlowRequest();
        request.setNamespace("433d8b23-06e9-408c-aaaa-90d4d1b9a4af");
        request.setGroupId("xuren_test");
        request.setWorkflowId(29L);
        GetWorkFlowResponse response;
        try {
            response = client.getAcsResponse(request);
            if (!response.getSuccess()) {
                System.out.println(JsonUtil.toJson(response));
            } else {
                System.out.println("工作流基本信息:" + response.getData().getWorkFlowInfo());
                System.out.println("工作流节点信息:" + response.getData().getWorkFlowNodeInfo());
            }
        } catch (ServerException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ClientException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    
}