Appearance
公海组件删除
接口信息
- 接口:
/agent-api/user/{user_id}/component - 请求方式:
DELETE
路由参数
| 参数 | 类型 | 示例 | 解释 | 必填 |
|---|---|---|---|---|
| user_id | string | 5832d184-dd53-42a0-8ace-0bf8d660f4cc | 用户 id(主账号) | 是 |
请求参数
| 参数 | 类型 | 示例 | 解释 | 必填 |
|---|---|---|---|---|
| deletes | array | ["12d81f68-4ae2-430a-bd57-8e2f565fc866"] | 组件 id | 是 |
请求示例
json
{
"deletes": ["d167cb45-fe00-4ec3-8af5-4679b22474ac"]
}cURL
curl -X DELETE "https://ai.api.longlonglong.cn/agent-api/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/component" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"deletes": ["d167cb45-fe00-4ec3-8af5-4679b22474ac"]
}'Go
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
jsonData := []byte(`{"deletes": ["d167cb45-fe00-4ec3-8af5-4679b22474ac"]}`)
client := &http.Client{}
req, _ := http.NewRequest("DELETE", "https://ai.api.longlonglong.cn/agent-api/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/component", 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/component", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TOKEN"
},
body: JSON.stringify({
deletes: ["d167cb45-fe00-4ec3-8af5-4679b22474ac"]
})
});
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/component");
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 = "{\"deletes\":[\"d167cb45-fe00-4ec3-8af5-4679b22474ac\"]}";
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 = ["deletes" => ["d167cb45-fe00-4ec3-8af5-4679b22474ac"]];
curl_setopt($ch, CURLOPT_URL, "https://ai.api.longlonglong.cn/agent-api/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/component");
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/component"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TOKEN"
}
data = {"deletes": ["d167cb45-fe00-4ec3-8af5-4679b22474ac"]}
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"({"deletes":["d167cb45-fe00-4ec3-8af5-4679b22474ac"]})";
curl_easy_setopt(curl, CURLOPT_URL, "https://ai.api.longlonglong.cn/agent-api/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/component");
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": []
}