Skip to content

设置隐私与安全

接口信息

  • 接口: /agent-api/user/{user_id}/settings/save_security
  • 请求方式: POST

路由参数

参数类型示例解释必填
user_idstring5433b412-07d5-44e6-9fa4-deb65e43bc93用户 id

请求参数

参数类型示例解释必填
dataarray[]隐私数据
codestring"123456789"安全码

请求示例

cURL
curl -X POST "https://ai.api.longlonglong.cn/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/settings/save_security" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "data": [
        {
            "slug": "disable_crm_phone",
            "extra": {
                "style": 1
            }
        },
        {
            "slug": "disable_task_phone",
            "extra": {
                "style": 1
            }
        }
    ],
    "code": "123456"
  }'
Go
package main

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

func main() {
    url := "https://ai.api.longlonglong.cn/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/settings/save_security"

    payload := map[string]interface{}{
        "data": []map[string]interface{}{
            {
                "slug": "disable_crm_phone",
                "extra": map[string]int{
                    "style": 1,
                },
            },
            {
                "slug": "disable_task_phone",
                "extra": map[string]int{
                    "style": 1,
                },
            },
        },
        "code": "123456",
    }

    jsonData, _ := json.Marshal(payload)

    req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("Authorization", "Bearer YOUR_TOKEN")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}
JavaScript
const url = 'https://ai.api.longlonglong.cn/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/settings/save_security';

const data = {
    data: [
        {
            slug: 'disable_crm_phone',
            extra: {
                style: 1
            }
        },
        {
            slug: 'disable_task_phone',
            extra: {
                style: 1
            }
        }
    ],
    code: '123456'
};

fetch(url, {
    method: 'POST',
    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.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws Exception {
        String urlString = "https://ai.api.longlonglong.cn/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/settings/save_security";
        URL url = new URL(urlString);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();

        conn.setRequestMethod("POST");
        conn.setRequestProperty("Content-Type", "application/json");
        conn.setRequestProperty("Authorization", "Bearer YOUR_TOKEN");
        conn.setDoOutput(true);

        String jsonInputString = "{\"data\":[{\"slug\":\"disable_crm_phone\",\"extra\":{\"style\":1}},{\"slug\":\"disable_task_phone\",\"extra\":{\"style\":1}}],\"code\":\"123456\"}";

        try (OutputStream os = conn.getOutputStream()) {
            byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
            os.write(input, 0, input.length);
        }

        System.out.println("Response Code: " + conn.getResponseCode());
    }
}
PHP
<?php

$url = 'https://ai.api.longlonglong.cn/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/settings/save_security';

$data = [
    'data' => [
        [
            'slug' => 'disable_crm_phone',
            'extra' => [
                'style' => 1
            ]
        ],
        [
            'slug' => 'disable_task_phone',
            'extra' => [
                'style' => 1
            ]
        ]
    ],
    'code' => '123456'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Authorization: Bearer YOUR_TOKEN'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
Python
import requests

url = 'https://ai.api.longlonglong.cn/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/settings/save_security'

headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
}

data = {
    'data': [
        {
            'slug': 'disable_crm_phone',
            'extra': {
                'style': 1
            }
        },
        {
            'slug': 'disable_task_phone',
            'extra': {
                'style': 1
            }
        }
    ],
    'code': '123456'
}

response = requests.post(url, json=data, 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/5433b412-07d5-44e6-9fa4-deb65e43bc93/settings/save_security";
        std::string json_data = R"({"data":[{"slug":"disable_crm_phone","extra":{"style":1}},{"slug":"disable_task_phone","extra":{"style":1}}],"code":"123456"})";

        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_POST, 1L);
        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;
}

slug取值说明

说明
disable_crm_phone加密客户公海号码
disable_task_phone加密任务号码
disable_record_phone加密通话记录号码
disable_artificial_outbound_phone加密人工外呼号码
disable_customer_management_phone加密客户管理号码
disable_wechat_phone加密微信通知号码

返回示例

json
{
    "code": 200,
    "status": "success",
    "message": "保存用户隐私与安全成功",
    "data": []
}

基于 MIT 许可发布