Appearance
子账户列表
接口信息
- 接口:
/agent-api/user/{user_id}/subset_users - 请求方式:
GET
路由参数
| 参数 | 类型 | 示例 | 解释 | 必填 |
|---|---|---|---|---|
| user_id | string | 5433b412-07d5-44e6-9fa4-deb65e43bc93 | 用户 id | 是 |
请求参数
| 参数 | 类型 | 示例 | 解释 | 必填 |
|---|---|---|---|---|
| page | int | 1 | 页码 | 是 |
| per_page | int | 15 | 每页数量 | 否 |
| id | string | b3248eaa-c932-4727-b1e9-f99c51d59cb4 | 子账号 id | 否 |
| name | string | 测试账号 | 用户名 | 否 |
| string | 123456@qq.com | 邮箱 | 否 | |
| phone | string | 123456789 | 手机号码 | 否 |
请求示例
cURL
curl -X GET "https://api.wolfsmartcloud.com/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/subset_users?page=1&per_page=15&id=b3248eaa-c932-4727-b1e9-f99c51d59cb4&name=%E6%B5%8B%E8%AF%95%E8%B4%A6%E5%8F%B7&email=123456%40qq.com&phone=123456789" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN"Go
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.wolfsmartcloud.com/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/subset_users?page=1&per_page=15&id=b3248eaa-c932-4727-b1e9-f99c51d59cb4&name=%E6%B5%8B%E8%AF%95%E8%B4%A6%E5%8F%B7&email=123456%40qq.com&phone=123456789"
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 params = new URLSearchParams({
page: 1,
per_page: 15,
id: "b3248eaa-c932-4727-b1e9-f99c51d59cb4",
name: "测试账号",
email: "123456@qq.com",
phone: "123456789"
});
const url = `https://api.wolfsmartcloud.com/agent-api/user/${userId}/subset_users?${params}`;
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;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
public class Main {
public static void main(String[] args) throws IOException, InterruptedException {
HttpClient client = HttpClient.newHttpClient();
String params = "page=1&per_page=15&id=b3248eaa-c932-4727-b1e9-f99c51d59cb4&name=" +
URLEncoder.encode("测试账号", StandardCharsets.UTF_8) +
"&email=123456%40qq.com&phone=123456789";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.wolfsmartcloud.com/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/subset_users?" + params))
.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();
$params = http_build_query([
"page" => 1,
"per_page" => 15,
"id" => "b3248eaa-c932-4727-b1e9-f99c51d59cb4",
"name" => "测试账号",
"email" => "123456@qq.com",
"phone" => "123456789"
]);
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wolfsmartcloud.com/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/subset_users?" . $params,
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://api.wolfsmartcloud.com/agent-api/user/{user_id}/subset_users"
params = {
"page": 1,
"per_page": 15,
"id": "b3248eaa-c932-4727-b1e9-f99c51d59cb4",
"name": "测试账号",
"email": "123456@qq.com",
"phone": "123456789"
}
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://api.wolfsmartcloud.com/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/subset_users?page=1&per_page=15&id=b3248eaa-c932-4727-b1e9-f99c51d59cb4&name=%E6%B5%8B%E8%AF%95%E8%B4%A6%E5%8F%B7&email=123456%40qq.com&phone=123456789");
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": "91f9254f-ca58-49af-be34-8370d7549d73",
"name": "子账户1",
"phone": "123456789",
"email": "123456789@qq.com",
"sex": 0,
"alias": "账户1",
"duty": "员工",
"landline_phone": null,
"qq": null,
"wechat": null,
"birthday": "2022-07-13",
"department": "部门",
"created_at": "2022-07-13 17:12:37",
"updated_at": "2022-07-13 17:58:42"
}
],
"meta": {
"has_pages": false,
"total": 5,
"last_page": 1,
"current_page": 1,
"per_page": 15
}
}字段说明
| 字段 | 说明 |
|---|---|
| id | 子账户ID |
| name | 子账户名称 |
| phone | 手机号码 |
| 邮箱 | |
| sex | 性别:0-未知,1-男,2-女 |
| alias | 别名 |
| duty | 职位 |
| landline_phone | 座机 |
| QQ号 | |
| 微信 | |
| birthday | 生日 |
| department | 部门 |
| created_at | 创建时间 |
| updated_at | 修改时间 |