此端点可以帮助您
响应包含公开的目录数据以及后续 API 请求所需的上下文。
何时使用
当输入标识符或参数已知、需要一个可预期的 API 结果时,请使用此方法。
先查看结果和常见工作流,然后再了解参数和可运行的请求示例。
响应包含公开的目录数据以及后续 API 请求所需的上下文。
当输入标识符或参数已知、需要一个可预期的 API 结果时,请使用此方法。
只请求您需要的对象,而无需加载更大的集合。
将 Linktree API 结果添加到记录、工作流和内部工具中。
将响应用作相邻方法和多步骤工作流的输入。
两个版本完成相同的任务,接受相同的参数。使用切换按钮比较响应结构,并选择您的客户端所需的版本。
在本页面切换版本,即可在同一文档 URL 下比较响应结构。
V1 和 V2 的身份验证、必填参数和请求结构均相同。实际上,您只需在构建端点路径和解析响应时选择版本。
主要区别在于响应结构。新集成请使用 V2;仅在需要兼容现有客户端契约时保留 V1。
两个版本使用相同的 API 密钥请求头和相同的查询参数。本文档先展示共享的参数集合,然后展示各版本特定的端点路径和代码片段。
| 参数 | 必填 | 类型 | 示例 | 说明 |
|---|---|---|---|---|
category |
是 | all | business | creative | education | entertainment | fashion-beauty | food-beverage | government-politics | health-wellness | non-profit | other | tech | travel-tourism |
all |
Linktree directory category slug. Example: all. |
page |
否 | int |
1 |
Requested results page number. Example: 1. |
复制确切的端点路径、示例 URL 和代码片段时请选择版本。上方的参数列表保持不变。
GET /api/v2/linktr.ee/directory/users-by-categorycurl --request GET \
--url "https://www.scrapestorm.net/api/v2/linktr.ee/directory/users-by-category" \
--header "X-API-Key: 00000000-0000-4000-8000-000000000000" \
--get --data-urlencode 'category=all' \
# Optional parameters:
# --data-urlencode 'page=1'
from urllib.parse import urljoin
import requests
BASE_URL = "https://www.scrapestorm.net"
ENDPOINT = "/api/v2/linktr.ee/directory/users-by-category"
HEADERS = {"Accept": "application/json", "X-API-Key": "00000000-0000-4000-8000-000000000000"}
params = {
"category": "all",
}
# Optional parameters
# params["page"] = "1"
with requests.Session() as session:
response = session.request(
method="GET",
url=urljoin(BASE_URL, ENDPOINT),
headers=HEADERS,
params=params,
timeout=30,
)
response.raise_for_status()
payload = response.json()
print(payload)
const BASE_URL = "https://www.scrapestorm.net";
const endpoint = "/api/v2/linktr.ee/directory/users-by-category";
const params = new URLSearchParams({
category: "all",
});
// Optional parameters
// params.set("page", "1");
const response = await fetch(`${BASE_URL}${endpoint}?${params.toString()}`, {
method: "GET",
headers: {
Accept: "application/json",
"X-API-Key": "00000000-0000-4000-8000-000000000000",
},
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status} ${response.statusText}`);
}
const payload = await response.json();
console.log(payload);
import axios from "axios";
const client = axios.create({
baseURL: "https://www.scrapestorm.net",
timeout: 30000,
headers: {
Accept: "application/json",
"X-API-Key": "00000000-0000-4000-8000-000000000000",
},
});
const params = {
category: "all",
};
// Optional parameters
// params.page = "1";
const { data: payload } = await client.request({
method: "GET",
url: endpoint,
params,
});
console.log(payload);
<?php
declare(strict_types=1);
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
$client = new Client([
'base_uri' => "https://www.scrapestorm.net",
'timeout' => 30.0,
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => "00000000-0000-4000-8000-000000000000",
],
]);
$query = [
"category" => "all",
];
// Optional parameters
// $query["page"] = "1";
try {
$response = $client->request("GET", "/api/v2/linktr.ee/directory/users-by-category", [
'query' => $query,
]);
$payload = json_decode(
(string) $response->getBody(),
true,
512,
JSON_THROW_ON_ERROR
);
var_dump($payload);
} catch (GuzzleException $e) {
throw $e;
}
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"time"
)
func main() {
baseURL := "https://www.scrapestorm.net"
endpoint := "/api/v2/linktr.ee/directory/users-by-category"
params := url.Values{}
params.Set("category", "all")
// Optional parameters
// params.Set("page", "1")
req, err := http.NewRequest(
"GET",
fmt.Sprintf("%s%s?%s", baseURL, endpoint, params.Encode()),
nil,
)
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("X-API-Key", "00000000-0000-4000-8000-000000000000")
client := &http.Client{Timeout: 30 * time.Second}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var payload any
if err := json.NewDecoder(resp.Body).Decode(&payload); err != nil {
panic(err)
}
fmt.Printf("%+v\n", payload)
}
复制确切的端点路径、示例 URL 和代码片段时请选择版本。上方的参数列表保持不变。
GET /api/v1/linktr.ee/directory/users-by-categorycurl --request GET \
--url "https://www.scrapestorm.net/api/v1/linktr.ee/directory/users-by-category" \
--header "X-API-Key: 00000000-0000-4000-8000-000000000000" \
--get --data-urlencode 'category=all' \
# Optional parameters:
# --data-urlencode 'page=1'
from urllib.parse import urljoin
import requests
BASE_URL = "https://www.scrapestorm.net"
ENDPOINT = "/api/v1/linktr.ee/directory/users-by-category"
HEADERS = {"Accept": "application/json", "X-API-Key": "00000000-0000-4000-8000-000000000000"}
params = {
"category": "all",
}
# Optional parameters
# params["page"] = "1"
with requests.Session() as session:
response = session.request(
method="GET",
url=urljoin(BASE_URL, ENDPOINT),
headers=HEADERS,
params=params,
timeout=30,
)
response.raise_for_status()
payload = response.json()
print(payload)
const BASE_URL = "https://www.scrapestorm.net";
const endpoint = "/api/v1/linktr.ee/directory/users-by-category";
const params = new URLSearchParams({
category: "all",
});
// Optional parameters
// params.set("page", "1");
const response = await fetch(`${BASE_URL}${endpoint}?${params.toString()}`, {
method: "GET",
headers: {
Accept: "application/json",
"X-API-Key": "00000000-0000-4000-8000-000000000000",
},
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status} ${response.statusText}`);
}
const payload = await response.json();
console.log(payload);
import axios from "axios";
const client = axios.create({
baseURL: "https://www.scrapestorm.net",
timeout: 30000,
headers: {
Accept: "application/json",
"X-API-Key": "00000000-0000-4000-8000-000000000000",
},
});
const params = {
category: "all",
};
// Optional parameters
// params.page = "1";
const { data: payload } = await client.request({
method: "GET",
url: endpoint,
params,
});
console.log(payload);
<?php
declare(strict_types=1);
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
$client = new Client([
'base_uri' => "https://www.scrapestorm.net",
'timeout' => 30.0,
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => "00000000-0000-4000-8000-000000000000",
],
]);
$query = [
"category" => "all",
];
// Optional parameters
// $query["page"] = "1";
try {
$response = $client->request("GET", "/api/v1/linktr.ee/directory/users-by-category", [
'query' => $query,
]);
$payload = json_decode(
(string) $response->getBody(),
true,
512,
JSON_THROW_ON_ERROR
);
var_dump($payload);
} catch (GuzzleException $e) {
throw $e;
}
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"time"
)
func main() {
baseURL := "https://www.scrapestorm.net"
endpoint := "/api/v1/linktr.ee/directory/users-by-category"
params := url.Values{}
params.Set("category", "all")
// Optional parameters
// params.Set("page", "1")
req, err := http.NewRequest(
"GET",
fmt.Sprintf("%s%s?%s", baseURL, endpoint, params.Encode()),
nil,
)
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("X-API-Key", "00000000-0000-4000-8000-000000000000")
client := &http.Client{Timeout: 30 * time.Second}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var payload any
if err := json.NewDecoder(resp.Body).Decode(&payload); err != nil {
panic(err)
}
fmt.Printf("%+v\n", payload)
}
预览保留了关键字段和集合中的前几项,便于您快速浏览响应结构。切换版本会改变 JSON 格式。
此简明 JSON 示例来自 V2 最近一次成功的验证运行。
{
"success": true,
"status": "ok",
"pagination": {
"page": 1,
"has_more": true
},
"search_context": {
"page": 1,
"category": "all"
},
"data": {
"directory_context": {
"selected_category": {
"category_id": "all",
"label": "All Categories"
},
"selected_subcategory": {
"category_id": "all",
"subcategory_id": "all",
"label": "All"
},
"title": "Explore the Linktree community",
"description": "Discover everything our most popular creators are sharing all over the internet, in one simple place."
},
"categories": {
"count": 13,
"items": [
{
"category_id": "all",
"label": "All Categories"
},
{
"category_id": "business",
"label": "Business"
},
{
"_more_items": 11
}
]
},
"profiles": {
"count": 18,
"items": [
{
"username": "marjem",
"display_name": "Marjem Kat",
"url": "https://linktr.ee/marjem",
"avatar_url": "https://example.com/image.jpg",
"category": {
"category_id": "other",
"label": "Other"
},
"badges": [],
"is_verified": false
},
{
"username": "frontlinesmedia",
"display_name": null,
"url": "https://linktr.ee/frontlinesmedia",
"avatar_url": "https://example.com/image.jpg",
"category": {
"category_id": "entertainment",
"label": "Entertainment"
},
"badges": [],
"is_verified": false
},
{
"_more_items": 16
}
]
},
"total_pages": 21112
}
}
此简明 JSON 示例来自 V1 最近一次成功的验证运行。
{
"success": true,
"status": "ok",
"search_context": {
"page": 1,
"category": "all"
},
"data": {
"pageProps": {
"profiles": [
{
"profileTitle": "Marjem Kat",
"username": "marjem",
"category": {
"categoryId": "other",
"label": "Other",
"__typename": "Category"
},
"customAvatarUrl": "https://example.com/image.jpg",
"profileBadges": null,
"__typename": "FinderProfile",
"verificationTick": false
},
{
"profileTitle": null,
"username": "frontlinesmedia",
"category": {
"categoryId": "entertainment",
"label": "Entertainment",
"__typename": "Category"
},
"customAvatarUrl": "https://example.com/image.jpg",
"profileBadges": null,
"__typename": "FinderProfile",
"verificationTick": false
},
{
"_more_items": 16
}
],
"categories": [
{
"__typename": "Category",
"categoryId": "all",
"label": "All Categories"
},
{
"categoryId": "business",
"label": "Business",
"__typename": "Category"
},
{
"_more_items": 11
}
],
"subCategoriesOfSelectedCategory": [],
"selectedCategory": {
"__typename": "Category",
"categoryId": "all",
"label": "All Categories"
},
"selectedSubCategory": {
"categoryId": "all",
"subCategoryId": "all",
"label": "All",
"numberOfProfiles": 0
},
"pageTitle": "Explore the Linktree community",
"titleTag": "Explore the community | Linktree",
"pageDescription": "Discover everything our most popular creators are sharing all over the internet, in one simple place.",
"currentPage": 1,
"totalPages": 21112,
"isSearchEnabled": false,
"isSurveyEnabled": false,
"campaignVariation": null
},
"__N_SSP": true
}
}
将本文档作为第一个决策点,然后在将端点接入常规使用之前,继续了解价格、平台覆盖范围和集成规则。
借助这些解答,判断此 API 方法是否适合您的工作流、版本选择和上线计划。
该方法针对目录执行“按类别获取用户”操作。下方的简明响应示例展示了确切的字段结构。
新集成请选择 V2,因为它提供规范化的结构。仅在兼容已使用平台原生格式的客户端时使用 V1。
创建 API 密钥,在请求头中发送它,并提供表格中的必填参数。代码示例中已包含正确的路径和请求结构。