Appearance
任务列表
此接口【v1.2.31版本有变动】
接口信息
- 接口:
/agent-api/user/{user_id}/task - 请求方式:
GET
路由参数
| 参数 | 类型 | 示例 | 解释 | 必填 |
|---|---|---|---|---|
| user_id | string | 5832d184-dd53-42a0-8ace-0bf8d660f4cc | 用户 id | 是 |
请求参数
| 参数 | 类型 | 示例 | 解释 | 必填 |
|---|---|---|---|---|
| page | int | 1 | 页码 | 否 |
| per_page | int | 15 | 每页个数 | 否 |
| name | string | 任务 | 任务名称 | 否 |
| status | int || array | 1 || [1,2] | 1:暂停中 2:执行中 3:等待执行 | 否 |
| sub_user_id | string | 91f9254f-ca58-49af-be34-8370d7549d73 | 子账户 id(传递此参数则是对子账户操作) | 否 |
请求示例
cURL
curl -X GET "https://ai.api.longlonglong.cn/agent-api/user/${userId}/task?page=${page}&per_page=${perPage}&name=${name}&status=${status}&sub_user_id=${subUserId}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN"Go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
userId := "5832d184-dd53-42a0-8ace-0bf8d660f4cc"
page := 1
perPage := 15
name := "任务"
status := 1
subUserId := "91f9254f-ca58-49af-be34-8370d7549d73"
url := fmt.Sprintf("https://ai.api.longlonglong.cn/agent-api/user/%s/task?page=%d&per_page=%d&name=%s&status=%d&sub_user_id=%s", userId, page, perPage, name, status, subUserId)
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_TOKEN")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}JavaScript
const userId = '5832d184-dd53-42a0-8ace-0bf8d660f4cc';
const page = 1;
const perPage = 15;
const name = '任务';
const status = 1;
const subUserId = '91f9254f-ca58-49af-be34-8370d7549d73';
const params = new URLSearchParams({
page: page,
per_page: perPage,
name: name,
status: status,
sub_user_id: subUserId
});
fetch(`https://ai.api.longlonglong.cn/agent-api/user/${userId}/task?${params}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => response.json())
.then(data => console.log(JSON.stringify(data)))
.catch(error => console.error(error));Java
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class Main {
public static void main(String[] args) {
String userId = "5832d184-dd53-42a0-8ace-0bf8d660f4cc";
int page = 1;
int perPage = 15;
String name = "任务";
int status = 1;
String subUserId = "91f9254f-ca58-49af-be34-8370d7549d73";
OkHttpClient client = new OkHttpClient();
String url = String.format("https://ai.api.longlonglong.cn/agent-api/user/%s/task?page=%d&per_page=%d&name=%s&status=%d&sub_user_id=%s", userId, page, perPage, name, status, subUserId);
Request request = new Request.Builder()
.url(url)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer YOUR_TOKEN")
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
} catch (Exception e) {
e.printStackTrace();
}
}
}PHP
<?php
$userId = '5832d184-dd53-42a0-8ace-0bf8d660f4cc';
$page = 1;
$perPage = 15;
$name = '任务';
$status = 1;
$subUserId = '91f9254f-ca58-49af-be34-8370d7549d73';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://ai.api.longlonglong.cn/agent-api/user/{$userId}/task?page={$page}&per_page={$perPage}&name={$name}&status={$status}&sub_user_id={$subUserId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer YOUR_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;Python
import requests
userId = "5832d184-dd53-42a0-8ace-0bf8d660f4cc"
page = 1
perPage = 15
name = "任务"
status = 1
subUserId = "91f9254f-ca58-49af-be34-8370d7549d73"
url = f"https://ai.api.longlonglong.cn/agent-api/user/{userId}/task"
params = {
"page": page,
"per_page": perPage,
"name": name,
"status": status,
"sub_user_id": subUserId
}
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TOKEN"
}
response = requests.get(url, headers=headers, params=params)
print(response.json())C++
#include <iostream>
#include <string>
#include <curl/curl.h>
size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp) {
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
int main() {
std::string userId = "5832d184-dd53-42a0-8ace-0bf8d660f4cc";
int page = 1;
int perPage = 15;
std::string name = "任务";
int status = 1;
std::string subUserId = "91f9254f-ca58-49af-be34-8370d7549d73";
CURL* curl;
CURLcode res;
std::string readBuffer;
curl = curl_easy_init();
if(curl) {
std::string url = "https://ai.api.longlonglong.cn/agent-api/user/" + userId + "/task?page=" + std::to_string(page) + "&per_page=" + std::to_string(perPage) + "&name=" + name + "&status=" + std::to_string(status) + "&sub_user_id=" + subUserId;
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "Authorization: Bearer YOUR_TOKEN");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
res = curl_easy_perform(curl);
if(res != CURLE_OK) {
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
} else {
std::cout << readBuffer << std::endl;
}
curl_easy_cleanup(curl);
}
return 0;
}返回示例
json
{
"code": 200,
"status": "success",
"message": "返回任务列表信息",
"data": [
{
"uuid": "0a1fd4ea-3bb6-4511-8-1c7931a22d55",
"name": "0616",
"create_datetime": "2020-06-16 16:33:28",
"maximumcall": 1,
"dial_time_id": 1505,
"status": 2,
"status_str": "执行中",
"destination_extension": 5,
"caller_line_id": "a62bdf07-df18-0f-07b411df4b6e",
"bridge_group_id": 3,
"group": {
"id": 1,
"name": "话术组1"
}
}
]
}