Appearance
任务修改
接口信息
- 接口:
/agent-api/user/{user_id}/task/{task_id} - 请求方式:
PUT
路由参数
| 参数 | 类型 | 示例 | 解释 | 必填 |
|---|---|---|---|---|
| user_id | string | 5832d184-dd53-42a0-8ace-0bf8d660f4cc | 用户id | 是 |
| task_id | string | f232d184-dd54-42a0-8ace-0bf8d660f4cc | 任务id | 是 |
请求参数
| 参数 | 类型 | 示例 | 解释 | 必填 |
|---|---|---|---|---|
| sub_user_id | string | 5b55bcca-d653-4a58-8f9a-437fb0601f8e | 子账户 id(传递此参数则是对子账户操作) | 否 |
| caller_line_id | string | 37d73edf-4628-4cf1-8beb-758433fd0aab | 使用任务初始化 API 中属性 caller_line_list 的 value | 是 |
| bridge_group_id | int | 1 | 使用转接组的 id 不传这个键,则表示为空。传了则必填 | 否 |
| destination_extension | int | 297 | 使用话术分组的 id | 是 |
| dial_time_id | int | 5 | 呼叫时间组 ID | 是 |
| maximumcall | int | 1 | 并发数💡注意:不得超过选用线路的 residue 值 | 是 |
| name | string | 测试任务 | 任务名称 | 是 |
| remark | string | 第一个任务 | 任务描述 | 否 |
| call_pause_second | int | 10 | 每通电话的呼叫间隔,单并发的建议间隔 10 秒,多并发可选择 0 秒 | 否 |
| auto_recycle_rule_id | int | 1 | 重呼规则 id | 否 |
| elasticity_type | bool | FALSE | 动态坐席 | 否 |
| end_action | int | 1 | 任务结束动作 此动作不能与动态坐席同时开启 | 否 |
| llm_intention_id | int | 1 | 大模型质检配置 id | 否 |
| task_type | int | 1 | 任务类型 1-任务外呼 2-任务呼入 4-大模型外呼 5-大模型呼入 | 否 |
请求示例
cURL
curl -X PUT "https://ai.api.longlonglong.cn/agent-api/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task/f232d184-dd54-42a0-8ace-0bf8d660f4cc" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"name": "API任务创建测试",
"destination_extension": 3,
"dial_time_id": 1,
"maximumcall": 3,
"caller_line_id": "f352fd9d-b86b-49eb-942c-3ae2f69fa3b0",
"remark": "API-test",
"end_action": 1
}'Go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://ai.api.longlonglong.cn/agent-api/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task/f232d184-dd54-42a0-8ace-0bf8d660f4cc"
payload := map[string]interface{}{
"name": "API任务创建测试",
"destination_extension": 3,
"dial_time_id": 1,
"maximumcall": 3,
"caller_line_id": "f352fd9d-b86b-49eb-942c-3ae2f69fa3b0",
"remark": "API-test",
"end_action": 1,
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("PUT", url, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_TOKEN")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}JavaScript
const userId = "5832d184-dd53-42a0-8ace-0bf8d660f4cc";
const taskId = "f232d184-dd54-42a0-8ace-0bf8d660f4cc";
const url = `https://ai.api.longlonglong.cn/agent-api/user/${userId}/task/${taskId}`;
const data = {
name: "API任务创建测试",
destination_extension: 3,
dial_time_id: 1,
maximumcall: 3,
caller_line_id: "f352fd9d-b86b-49eb-942c-3ae2f69fa3b0",
remark: "API-test",
end_action: 1
};
fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TOKEN"
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.error("Error:", error));Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String url = "https://ai.api.longlonglong.cn/agent-api/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task/f232d184-dd54-42a0-8ace-0bf8d660f4cc";
String json = """
{
"name": "API任务创建测试",
"destination_extension": 3,
"dial_time_id": 1,
"maximumcall": 3,
"caller_line_id": "f352fd9d-b86b-49eb-942c-3ae2f69fa3b0",
"remark": "API-test",
"end_action": 1
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer YOUR_TOKEN")
.PUT(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpClient client = HttpClient.newHttpClient();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}PHP
<?php
$userId = "5832d184-dd53-42a0-8ace-0bf8d660f4cc";
$taskId = "f232d184-dd54-42a0-8ace-0bf8d660f4cc";
$url = "https://ai.api.longlonglong.cn/agent-api/user/{$userId}/task/{$taskId}";
$data = [
'name' => 'API任务创建测试',
'destination_extension' => 3,
'dial_time_id' => 1,
'maximumcall' => 3,
'caller_line_id' => 'f352fd9d-b86b-49eb-942c-3ae2f69fa3b0',
'remark' => 'API-test',
'end_action' => 1
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Authorization: Bearer YOUR_TOKEN'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;Python
import requests
user_id = "5832d184-dd53-42a0-8ace-0bf8d660f4cc"
task_id = "f232d184-dd54-42a0-8ace-0bf8d660f4cc"
url = f"https://ai.api.longlonglong.cn/agent-api/user/{user_id}/task/{task_id}"
data = {
"name": "API任务创建测试",
"destination_extension": 3,
"dial_time_id": 1,
"maximumcall": 3,
"caller_line_id": "f352fd9d-b86b-49eb-942c-3ae2f69fa3b0",
"remark": "API-test",
"end_action": 1
}
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TOKEN"
}
response = requests.put(url, json=data, headers=headers)
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() {
CURL* curl;
CURLcode res;
std::string readBuffer;
curl = curl_easy_init();
if(curl) {
std::string json_data = R"({
"name": "API任务创建测试",
"destination_extension": 3,
"dial_time_id": 1,
"maximumcall": 3,
"caller_line_id": "f352fd9d-b86b-49eb-942c-3ae2f69fa3b0",
"remark": "API-test",
"end_action": 1
})";
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_URL, "https://ai.api.longlonglong.cn/agent-api/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task/f232d184-dd54-42a0-8ace-0bf8d660f4cc");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_data.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
res = curl_easy_perform(curl);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
else
std::cout << readBuffer << std::endl;
}
return 0;
}返回示例
json
{
"code": 200,
"status": "success",
"message": "修改成功",
"data": ""
}