Skip to content

话术分组

接口信息

  • 接口: /agent-api/group/{user_id}
  • 请求方式: GET

路由参数

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

请求参数

参数类型示例解释必填
pageint1页码
per_pageint15每页数量

请求示例

cURL
curl -X GET "https://ai.api.longlonglong.cn/agent-api/group/5433b412-07d5-44e6-9fa4-deb65e43bc93?page=1&per_page=15" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN"
Go
package main

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

func main() {
    url := "https://ai.api.longlonglong.cn/agent-api/group/5433b412-07d5-44e6-9fa4-deb65e43bc93?page=1&per_page=15"

    req, _ := http.NewRequest("GET", url, nil)
    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 userId = "5433b412-07d5-44e6-9fa4-deb65e43bc93";
const url = `https://ai.api.longlonglong.cn/agent-api/group/${userId}?page=1&per_page=15`;

fetch(url, {
  method: "GET",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_TOKEN"
  }
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error("Error:", error));
Java
import java.net.URI;
import java.net.http.*;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException, InterruptedException {
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://ai.api.longlonglong.cn/agent-api/group/5433b412-07d5-44e6-9fa4-deb65e43bc93?page=1&per_page=15"))
            .header("Content-Type", "application/json")
            .header("Authorization", "Bearer YOUR_TOKEN")
            .GET()
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
PHP
<?php

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => "https://ai.api.longlonglong.cn/agent-api/group/5433b412-07d5-44e6-9fa4-deb65e43bc93?page=1&per_page=15",
    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

user_id = "5433b412-07d5-44e6-9fa4-deb65e43bc93"
url = f"https://ai.api.longlonglong.cn/agent-api/group/{user_id}"

params = {
    "page": 1,
    "per_page": 15
}

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) {
        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, "https://ai.api.longlonglong.cn/agent-api/group/5433b412-07d5-44e6-9fa4-deb65e43bc93?page=1&per_page=15");
        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);
        if(res != CURLE_OK)
            fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
        else
            std::cout << readBuffer << std::endl;

        curl_easy_cleanup(curl);
    }
    return 0;
}

返回示例

json
{
    "code": 200,
    "status": "success",
    "message": "查看话术分组列表成功",
    "data": [
        {
            "id": 41,
            "name": "0611",
            "user_id": "f00c8abc-433f-4666-a9d79605ced1",
            "debug": true,
            "deleted_at": null,
            "created_at": "2020-06-11 14:28:50",
            "updated_at": "2020-06-11 14:28:50",
            "link_word_group_id": null,
            "tag_scene_id": "c74ffa32-373d-46b1-b9d9cadc224",
            "default": false
        }
    ],
    "meta": {
        "has_pages": false,
        "total": 1,
        "last_page": 1,
        "current_page": 1,
        "per_page": 15
    }
}

字段说明

字段说明
id话术组ID
name话术组名称
user_id用户ID
debug是否调试模式
link_word_group_id衔接词组ID
tag_scene_id标签场景ID
default是否默认

如果不传page参数,则meta所在的键值数据不存在

基于 MIT 许可发布