Appearance
批量删除号码
批量删除号码(兼容2.0任务)
接口信息
- 接口:
/agent-api/user/{user_id}/task/{task_id}/number-batch-delete - 请求方式:
DELETE
路由参数
| 参数 | 类型 | 示例 | 解释 | 是否必填 |
|---|---|---|---|---|
| user_id | string | 4d99d91c-f5d9-49da-88da-758977cc58a9 | 用户id | 是 |
| task_id | string | b15b7392-a83f-4e0e-9570-31dd2ec8f85c | 任务id | 是 |
注意事项
如果使用2.0 任务id,需暂停任务才可以删除号码,否则会出现以下报错:
json
{
"code": 6007,
"status": "error",
"message": "2.0任务启动中,请先停止任务",
"data": []
}请求参数
| 参数 | 类型 | 示例 | 解释 | 是否必填 |
|---|---|---|---|---|
| customer_info_list | array | [] | 号码 | 是 |
| encryption | bool | FALSE | 是否加密号码(开启接口加密后有效) | 否 |
| sub_user_id | string | 0c05bd69-4ac5-433f-8b01-fe2044ba8301 | 子账户id | 否 |
请求示例
cURL
curl -X DELETE "https://ai.api.longlonglong.cn/agent-api/user/4d99d91c-f5d9-49da-88da-758977cc58a9/task/b15b7392-a83f-4e0e-9570-31dd2ec8f85c/number-batch-delete" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"customer_info_list": [
{"phone": "18361201206"},
{"phone": "18361201208"}
]
}'Go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://ai.api.longlonglong.cn/agent-api/user/4d99d91c-f5d9-49da-88da-758977cc58a9/task/b15b7392-a83f-4e0e-9570-31dd2ec8f85c/number-batch-delete"
payload := map[string]interface{}{
"customer_info_list": []map[string]string{
{"phone": "18361201206"},
{"phone": "18361201208"},
},
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("DELETE", 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 url = "https://ai.api.longlonglong.cn/agent-api/user/4d99d91c-f5d9-49da-88da-758977cc58a9/task/b15b7392-a83f-4e0e-9570-31dd2ec8f85c/number-batch-delete";
const data = {
customer_info_list: [
{ phone: "18361201206" },
{ phone: "18361201208" }
]
};
fetch(url, {
method: "DELETE",
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.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.io.OutputStream;
public class Main {
public static void main(String[] args) throws Exception {
String url = "https://ai.api.longlonglong.cn/agent-api/user/4d99d91c-f5d9-49da-88da-758977cc58a9/task/b15b7392-a83f-4e0e-9570-31dd2ec8f85c/number-batch-delete";
String jsonInputString = "{\"customer_info_list\":[{\"phone\":\"18361201206\"},{\"phone\":\"18361201208\"}]}";
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Authorization", "Bearer YOUR_TOKEN");
con.setDoOutput(true);
try (OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
System.out.println("Response Code: " + con.getResponseCode());
}
}PHP
<?php
$url = "https://ai.api.longlonglong.cn/agent-api/user/4d99d91c-f5d9-49da-88da-758977cc58a9/task/b15b7392-a83f-4e0e-9570-31dd2ec8f85c/number-batch-delete";
$data = [
"customer_info_list" => [
["phone" => "18361201206"],
["phone" => "18361201208"]
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
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
url = "https://ai.api.longlonglong.cn/agent-api/user/4d99d91c-f5d9-49da-88da-758977cc58a9/task/b15b7392-a83f-4e0e-9570-31dd2ec8f85c/number-batch-delete"
payload = {
"customer_info_list": [
{"phone": "18361201206"},
{"phone": "18361201208"}
]
}
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TOKEN"
}
response = requests.delete(url, json=payload, headers=headers)
print(response.json())C++
#include <iostream>
#include <string>
#include <curl/curl.h>
int main() {
CURL* curl;
CURLcode res;
curl = curl_easy_init();
if (curl) {
std::string url = "https://ai.api.longlonglong.cn/agent-api/user/4d99d91c-f5d9-49da-88da-758977cc58a9/task/b15b7392-a83f-4e0e-9570-31dd2ec8f85c/number-batch-delete";
std::string json_data = R"({"customer_info_list":[{"phone":"18361201206"},{"phone":"18361201208"}]})";
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, url.c_str());
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_data.c_str());
res = curl_easy_perform(curl);
if (res != CURLE_OK) {
std::cerr << "curl_easy_perform() failed: " << curl_easy_strerror(res) << std::endl;
}
curl_easy_cleanup(curl);
}
return 0;
}返回数据
json
{
"code": 200,
"status": "success",
"message": "批量删除号码成功"
}