Appearance
获取可用的标签
接口信息
- 接口:
/agent-api/tag/{user_id}/usable_tags - 请求方式:
GET
路由参数
| 参数 | 类型 | 示例 | 解释 | 是否必填 |
|---|---|---|---|---|
| user_id | string | 4d99d91c-f5d9-49da-88da-758977cc58a9 | 用户 id | 是 |
请求参数
| 参数 | 类型 | 示例 | 解释 | 是否必填 |
|---|---|---|---|---|
| page | int | 1 | 页码 | 是 |
| status | array | [1,0] | 标签状态 1:启用 0:禁用 不传此参数默认返回的是启用的标签 | 否 |
请求示例
cURL
curl -X GET "https://ai.api.longlonglong.cn/agent-api/tag/4d99d91c-f5d9-49da-88da-758977cc58a9/usable_tags?page=1&status[]=1&status[]=0" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN"Go
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
client := &http.Client{}
req, err := http.NewRequest("GET", "https://ai.api.longlonglong.cn/agent-api/tag/4d99d91c-f5d9-49da-88da-758977cc58a9/usable_tags?page=1&status[]=1&status[]=0", nil)
if err != nil {
panic(err)
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer YOUR_TOKEN")
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 axios = require('axios');
axios.get('https://ai.api.longlonglong.cn/agent-api/tag/4d99d91c-f5d9-49da-88da-758977cc58a9/usable_tags', {
params: {
page: 1,
status: [1, 0]
},
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
},
paramsSerializer: {
indexes: null
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});Java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] args) throws Exception {
URL url = new URL("https://ai.api.longlonglong.cn/agent-api/tag/4d99d91c-f5d9-49da-88da-758977cc58a9/usable_tags?page=1&status[]=1&status[]=0");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Authorization", "Bearer YOUR_TOKEN");
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
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://ai.api.longlonglong.cn/agent-api/tag/4d99d91c-f5d9-49da-88da-758977cc58a9/usable_tags?page=1&status[]=1&status[]=0",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Authorization: Bearer YOUR_TOKEN"
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;Python
import requests
url = "https://ai.api.longlonglong.cn/agent-api/tag/4d99d91c-f5d9-49da-88da-758977cc58a9/usable_tags"
params = {
"page": 1,
"status[]": [1, 0]
}
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TOKEN"
}
response = requests.get(url, params=params, headers=headers)
print(response.json())C++
#include <iostream>
#include <curl/curl.h>
size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp) {
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
int main() {
CURL* curl;
CURLcode res;
std::string readBuffer;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://ai.api.longlonglong.cn/agent-api/tag/4d99d91c-f5d9-49da-88da-758977cc58a9/usable_tags?page=1&status[]=1&status[]=0");
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_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
std::cout << readBuffer << std::endl;
}
return 0;
}返回结果
json
{
"code": 200,
"status": "success",
"message": "查看可以的标签列表成功",
"data": [
{
"id": "a2dfab68-3861-4baa-994e-6fd3276ad1a0",
"name": "在忙",
"description": "在忙",
"color": "#d52b79",
"user_id": "f00c8abc-433f-4666-a9d6-70479605ced1",
"status": 1,
"created_at": "2020-05-15 10:38:19",
"tag_groups": [
{
"id": "cf70ada2-fc8b-428f-bf44-d006be3c53bb",
"name": "否定"
}
]
}
]
}