Appearance
批量重置号码状态
批量重置号码状态(兼容2.0任务重置号码状态)
接口信息
- 接口:
/agent-api/user/{user_id}/task/{task_id}/number-batch-reset - 请求方式:
PUT
路由参数
| 参数 | 类型 | 示例 | 解释 | 是否必填 |
|---|---|---|---|---|
| user_id | string | 4d99d91c-f5d9-49da-88da-758977cc58a9 | 主账户 id | 是 |
| task_id | string | b15b7392-a83f-4e0e-9570-31dd2ec8f85c | 任务 id | 是 |
请求参数
| 参数 | 类型 | 示例 | 解释 | 必填 |
|---|---|---|---|---|
| keyword | string | 18365474148 | 号码 | 否 |
| phones | array | ["13073797565", "18565891012"] | 需要重呼的号码,数组中的号码请传字符串类型 可开启加密 | 否 |
| start_at | string | 2020/7/28 | 创建开始时间 | 否 |
| end_at | string | 2020/7/28 | 创建结束时间(和 start_at 同时存在) | 否 |
| status | array | [0,2] | 筛选你所需要重置的号码的状态,数组中为 0-12 的数字,代表的含义分别是 0 等待呼叫 1 呼叫成功 2 运营商拦截 3 拒接 4 无应答、无人接听 5 空号 6 关机 7 停机 8 占线、用户正忙 9 呼入限制 10 欠费 11 黑名单 12 用户屏蔽 | 否 |
| encryption | bool | FALSE | 是否加密号码(开启接口加密后有效) | 否 |
| sub_user_id | string | 5-433f-8b01- | 子账户 id | 否 |
请求示例
cURL
curl -X PUT "https://ai.api.longlonglong.cn/agent-api/user/4d99d91c-f5d9-49da-88da-758977cc58a9/task/b15b7392-a83f-4e0e-9570-31dd2ec8f85c/number-batch-reset" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"keyword": "13934373090",
"phones": ["13934373090"],
"start_at": "2020-07-28 10:00:00",
"end_at": "2020-07-28 23:59:59",
"status": [0, 2]
}'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-reset"
payload := map[string]interface{}{
"keyword": "13934373090",
"phones": []string{"13934373090"},
"start_at": "2020-07-28 10:00:00",
"end_at": "2020-07-28 23:59:59",
"status": []int{0, 2},
}
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 url = "https://ai.api.longlonglong.cn/agent-api/user/4d99d91c-f5d9-49da-88da-758977cc58a9/task/b15b7392-a83f-4e0e-9570-31dd2ec8f85c/number-batch-reset";
const data = {
keyword: "13934373090",
phones: ["13934373090"],
start_at: "2020-07-28 10:00:00",
end_at: "2020-07-28 23:59:59",
status: [0, 2]
};
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.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-reset";
String jsonInputString = "{\"keyword\":\"13934373090\",\"phones\":[\"13934373090\"],\"start_at\":\"2020-07-28 10:00:00\",\"end_at\":\"2020-07-28 23:59:59\",\"status\":[0,2]}";
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
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-reset";
$data = [
"keyword" => "13934373090",
"phones" => ["13934373090"],
"start_at" => "2020-07-28 10:00:00",
"end_at" => "2020-07-28 23:59:59",
"status" => [0, 2]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
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-reset"
payload = {
"keyword": "13934373090",
"phones": ["13934373090"],
"start_at": "2020-07-28 10:00:00",
"end_at": "2020-07-28 23:59:59",
"status": [0, 2]
}
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TOKEN"
}
response = requests.put(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-reset";
std::string json_data = R"({"keyword":"13934373090","phones":["13934373090"],"start_at":"2020-07-28 10:00:00","end_at":"2020-07-28 23:59:59","status":[0,2]})";
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, "PUT");
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
{
"keyword": "13934373090",
"phones": [
"13934373090"
],
"start_at": "2020-07-28 10:00:00",
"end_at": "2020-07-28 23:59:59",
"status": [0, 2]
}返回数据
json
{
"code": 200,
"status": "success",
"message": "批量重置号码成功"
}