查询外呼任务列表(QueryOutboundTaskList)
分页查询外呼任务列表,返回任务ID、名称、状态、客户总数和时间信息。支持按任务名称、状态、关联场景和创建时间范围进行筛选。
前提条件
-
已安装SDK。
-
已获取并使用AccessKey的方式,请参考获取AccessKey并配置到环境变量。
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
|
Action |
String |
是 |
要执行的操作。取值:QueryOutboundTaskList。 |
QueryOutboundTaskList |
|
Version |
String |
是 |
API版本号。格式为:YYYY-MM-DD。取值:2025-11-27。 |
固定为2025-11-27 |
|
TaskName |
String |
否 |
任务名称(模糊) |
春节 |
|
TaskStatus |
String |
否 |
任务状态 |
RUNNING |
|
SceneId |
Number |
否 |
场景 ID |
1 |
|
StartDate |
String |
否 |
任务开始日期。 |
2024-01-01 |
|
EndDate |
String |
否 |
任务结束日期。 |
2024-01-31 |
|
Current |
Number |
否 |
当前页码。 |
1 |
|
Size |
Number |
否 |
每页条数。 |
10 |
响应参数
|
名称 |
类型 |
描述 |
示例值 |
|
RequestId |
String |
请求ID。 |
xxxx-xxxx-xxxx |
|
Success |
Boolean |
请求是否成功。 |
True |
|
Code |
String |
错误码。请求成功时为空。 |
None |
|
Message |
String |
错误信息或成功提示。 |
操作成功 |
|
Total |
Long |
总记录数。 |
20 |
|
Current |
Long |
当前页码。 |
1 |
|
Size |
Long |
每页条数。 |
10 |
|
Records |
Array |
返回数据,包含TaskId, TaskName, SceneId, SceneName, TaskStatus, TotalCustomers, CalledCount, SuccessCount, GmtCreate, GmtModified等字段,具体说明请参见下方返回参数说明。 |
使用示例
Python
import json
import os
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_tea_openapi.client import Client as OpenApiClient
from alibabacloud_tea_util import models as util_models
from alibabacloud_openapi_util.client import Client as OpenApiUtilClient
def main():
config = open_api_models.Config(
access_key_id=os.getenv("ACCESS_KEY_ID"),
access_key_secret=os.getenv("ACCESS_KEY_SECRET"),
)
config.endpoint = "thirdswaicall.aliyuncs.com"
config.protocol = "HTTPS"
client = OpenApiClient(config)
params = open_api_models.Params(
style="RPC",
version="2025-11-27",
action="QueryOutboundTaskList",
method="POST",
pathname="/",
protocol="HTTPS",
auth_type="AK",
req_body_type="json",
body_type="json",
)
body = {'Current': 1, 'Size': 10}
request = open_api_models.OpenApiRequest(query=OpenApiUtilClient.query(body))
runtime = util_models.RuntimeOptions(autoretry=True, max_attempts=3)
try:
resp = client.call_api(params, request, runtime)
print(json.dumps(resp.get("body", {}), ensure_ascii=False, indent=2))
except Exception as e:
print(f"调用失败: {e}")
if __name__ == "__main__":
main()
Java
import com.aliyun.teaopenapi.Client;
import com.aliyun.teaopenapi.models.Config;
import com.aliyun.teaopenapi.models.OpenApiRequest;
import com.aliyun.teaopenapi.models.Params;
import com.aliyun.teautil.models.RuntimeOptions;
import com.google.gson.Gson;
import java.util.HashMap;
import java.util.Map;
public class Demo {
public static void main(String[] args) throws Exception {
// 初始化配置
Config config = new Config()
.setAccessKeyId(System.getenv("ACCESS_KEY_ID"))
.setAccessKeySecret(System.getenv("ACCESS_KEY_SECRET"))
.setEndpoint("thirdswaicall.aliyuncs.com")
.setProtocol("HTTPS");
Client client = new Client(config);
// 设置 API 参数
Params params = new Params()
.setStyle("RPC")
.setVersion("2025-11-27")
.setAction("QueryOutboundTaskList")
.setMethod("POST")
.setPathname("/")
.setProtocol("HTTPS")
.setAuthType("AK")
.setReqBodyType("json")
.setBodyType("json");
// 构建请求参数
Map<String, Object> body = new HashMap<>();
// 根据实际需求添加请求参数
OpenApiRequest request = new OpenApiRequest()
.setQuery(com.aliyun.openapiutil.Client.query(body));
// 设置运行时选项(自动重试)
RuntimeOptions runtime = new RuntimeOptions()
.setAutoretry(true)
.setMaxAttempts(3);
try {
// 调用 API
Map<String, ?> response = client.callApi(params, request, runtime);
Gson gson = new Gson();
System.out.println(gson.toJson(response.get("body")));
} catch (Exception e) {
System.err.println("调用失败: " + e.getMessage());
}
}
}
返回示例
{
"Success": true,
"Code": null,
"Message": "操作成功",
"RequestId": "xxxx-xxxx-xxxx",
"Total": 20,
"Current": 1,
"Size": 10,
"Records": [
{
"TaskId": 1,
"TaskName": "春节促销外呼任务",
"SceneId": 1,
"SceneName": "客户回访场景",
"TaskStatus": "RUNNING",
"TotalCustomers": 1000,
"CalledCount": 500,
"SuccessCount": 300,
"GmtCreate": "2024-01-01 09:00:00",
"GmtModified": "2025-01-15 14:30:00"
}
]
}
具体的处理结果在Records节点中,以下为Records节点的参数说明。
|
名称 |
类型 |
描述 |
示例值 |
|
TaskId |
Number |
任务ID |
1 |
|
TaskName |
String |
任务名称 |
春节促销外呼任务 |
|
SceneId |
Number |
场景ID |
1 |
|
SceneName |
String |
场景名称 |
客户回访场景 |
|
TaskStatus |
String |
任务状态 |
RUNNING |
|
TotalCustomers |
Number |
客户总数 |
1000 |
|
CalledCount |
Number |
已呼叫数 |
500 |
|
SuccessCount |
Number |
成功数 |
300 |
|
GmtCreate |
String |
创建时间 |
2024-01-01 09:00:00 |
|
GmtModified |
String |
修改时间 |
2025-01-15 14:30:00 |
错误信息
如果执行报错,请参考错误信息进行解决。