Skip to content

删除客户公海数据

接口信息

  • 接口: /agent-api/user/{user_id}/del_customer
  • 请求方式: DELETE

路由参数

参数类型示例解释必填
user_idstring5832d184-dd53-42a0-8ace-0bf8d660f4cc用户 id

请求说明

  • phone 的数量不得超过 100 个
  • 当 phone 和 created_at 都为空或者不传时,此接口不会删除任何数据

请求参数

参数类型示例解释必填
phonearray["17458558658"]客户公海号码
created_atarray["2024-07-29 00:00:00", "2024-07-29 23:59:59"]号码导入时间
encryptionboolFALSE是否加密号码(开启接口加密后有效)

请求示例

json
{
    "phone": [
        "17458558658"
    ],
    "created_at": [
        "2024-07-26 00:00:00",
        "2024-07-27 23:59:59"
    ],
    "encryption": false
}
cURL
curl -X DELETE "https://ai.api.longlonglong.cn/agent-api/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/del_customer" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "phone": ["17458558658"],
    "created_at": ["2024-07-26 00:00:00", "2024-07-27 23:59:59"],
    "encryption": false
  }'
Go
package main

import (
    "bytes"
    "fmt"
    "io"
    "net/http"
)

func main() {
    jsonData := []byte(`{
        "phone": ["17458558658"],
        "created_at": ["2024-07-26 00:00:00", "2024-07-27 23:59:59"],
        "encryption": false
    }`)
    client := &http.Client{}
    req, _ := http.NewRequest("DELETE", "https://ai.api.longlonglong.cn/agent-api/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/del_customer", bytes.NewBuffer(jsonData))
    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("Authorization", "Bearer YOUR_TOKEN")
    resp, _ := client.Do(req)
    defer resp.Body.Close()
    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}
JavaScript
const response = await fetch("https://ai.api.longlonglong.cn/agent-api/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/del_customer", {
    method: "DELETE",
    headers: {
        "Content-Type": "application/json",
        "Authorization": "Bearer YOUR_TOKEN"
    },
    body: JSON.stringify({
        phone: ["17458558658"],
        created_at: ["2024-07-26 00:00:00", "2024-07-27 23:59:59"],
        encryption: false
    })
});
const data = await response.json();
console.log(data);
Java
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;

public class Main {
    public static void main(String[] args) throws Exception {
        URL url = new URL("https://ai.api.longlonglong.cn/agent-api/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/del_customer");
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("DELETE");
        conn.setRequestProperty("Content-Type", "application/json");
        conn.setRequestProperty("Authorization", "Bearer YOUR_TOKEN");
        conn.setDoOutput(true);
        String jsonInput = "{\"phone\":[\"17458558658\"],\"created_at\":[\"2024-07-26 00:00:00\",\"2024-07-27 23:59:59\"],\"encryption\":false}";
        try (OutputStream os = conn.getOutputStream()) {
            byte[] input = jsonInput.getBytes("utf-8");
            os.write(input, 0, input.length);
        }
        BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String line;
        StringBuilder response = new StringBuilder();
        while ((line = br.readLine()) != null) {
            response.append(line);
        }
        br.close();
        System.out.println(response.toString());
    }
}
PHP
<?php
$ch = curl_init();
$data = [
    "phone" => ["17458558658"],
    "created_at" => ["2024-07-26 00:00:00", "2024-07-27 23:59:59"],
    "encryption" => false
];
curl_setopt($ch, CURLOPT_URL, "https://ai.api.longlonglong.cn/agent-api/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/del_customer");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
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
import json

url = "https://ai.api.longlonglong.cn/agent-api/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/del_customer"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_TOKEN"
}
data = {
    "phone": ["17458558658"],
    "created_at": ["2024-07-26 00:00:00", "2024-07-27 23:59:59"],
    "encryption": False
}
response = requests.delete(url, headers=headers, data=json.dumps(data))
print(response.json())
C++
#include <iostream>
#include <curl/curl.h>
#include <string>

int main() {
    CURL* curl = curl_easy_init();
    if (curl) {
        struct curl_slist* headers = NULL;
        headers = curl_slist_append(headers, "Content-Type: application/json");
        headers = curl_slist_append(headers, "Authorization: Bearer YOUR_TOKEN");
        std::string json_data = R"({"phone":["17458558658"],"created_at":["2024-07-26 00:00:00","2024-07-27 23:59:59"],"encryption":false})";
        curl_easy_setopt(curl, CURLOPT_URL, "https://ai.api.longlonglong.cn/agent-api/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/del_customer");
        curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
        curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_data.c_str());
        CURLcode res = curl_easy_perform(curl);
        curl_easy_cleanup(curl);
    }
    return 0;
}

返回示例

json
{
    "code": 200,
    "status": "success",
    "message": "删除客户公海数据成功",
    "data": {
        "count": 10
    }
}

字段说明

字段说明
count删除客户公海数据的数量

基于 MIT 许可发布