need_formatboolean
Whether to clean and format the data
默认值:false
https://api.sandbase.ai/v1/api/reddit/app/subreddit-post-channelsReturns post channel and flair details for a target subreddit. Supports custom sort methods and time range filters.
[
{
"data": {
"subredditInfoByName": {
"__typename": "Subreddit",
"postFlairTemplates": [
{
"id": "f988392c-41f4-11ea-856e-0e3f43166111",
"isModOnly": false,
"richtext": null,
"text": "Arts/Crafts"
},
{
"id": "260873e0-c9b8-11e5-be06-0ecbb6f4dd8d",
"isModOnly": false,
"richtext": null,
"text": "Politics"
},
{
"id": "66cf8d7a-8718-11e9-803a-0e44312dcdb8",
"isModOnly": false,
"richtext": null,
"text": "Misleading Title"
},
"… 16 more items in the full response"
]
}
}
}
]选择一个示例,将其输入和结果加载到 playground 中。
Returns the post flair templates for a subreddit. You send the subreddit name in subreddit_name. The request also accepts sort, range and need_format.
id values to their text labels when you group posts by category.curl -X POST "https://api.sandbase.ai/v1/api/reddit/app/subreddit-post-channels" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
need_format | boolean | No | Whether to clean and format the data |
range | string | No | Time range, supports HOUR, DAY, WEEK, MONTH, YEAR, ALL |
sort | string | No | Sort method, supports HOT, NEW, TOP, CONTROVERSIAL, RISING |
subreddit_name | string | No | Subreddit name |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"subredditInfoByName": {
"__typename": "Subreddit",
"postFlairTemplates": [
{
"id": "260873e0-c9b8-11e5-be06-0ecbb6f4dd8d",
"isModOnly": false,
"richtext": null,
"text": "Politics"
}
]
}
}
| Field | Meaning |
|---|---|
subredditInfoByName | Top-level object for the requested subreddit. |
subredditInfoByName.__typename | Object type. The value is Subreddit. |
subredditInfoByName.postFlairTemplates[] | List of post flair templates that the subreddit defines. |
subredditInfoByName.postFlairTemplates[].id | Unique ID of the flair template, in UUID format. |
subredditInfoByName.postFlairTemplates[].text | Display label of the flair, such as Politics or Backstory. |
subredditInfoByName.postFlairTemplates[].isModOnly | Boolean. When true, only moderators can use this flair. In the sample it is false for every flair. |
subredditInfoByName.postFlairTemplates[].richtext | Rich text version of the flair label. It is null in the sample, so the plain text field holds the label. |
subreddit_name is pics, sort is HOT, range is DAY and need_format is false.sort accepts HOT, NEW, TOP, CONTROVERSIAL and RISING. range accepts HOUR, DAY, WEEK, MONTH, YEAR and ALL.$0.001 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.
开始构建
具备统一身份验证和使用情况跟踪的平台 API 端点。
curl -X POST "https://api.sandbase.ai/v1/api/reddit/app/subreddit-post-channels" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sort": "HOT",
"range": "DAY",
"need_format": false,
"subreddit_name": "pics"
}'将您的 SandBase API 密钥设置到服务器环境中。请求使用 Bearer 身份验证。
export SANDBASE_API_KEY="YOUR_API_KEY"请将密钥保存在服务器端。不要在浏览器代码中暴露它。
need_formatbooleanWhether to clean and format the data
默认值:false
rangestringTime range, supports HOUR, DAY, WEEK, MONTH, YEAR, ALL
默认值:"DAY"
sortstringSort method, supports HOT, NEW, TOP, CONTROVERSIAL, RISING
默认值:"HOT"
subreddit_namestringSubreddit name
默认值:"pics"
这是该 API 保存的示例响应;查看时不会发起实时请求。
[
{
"data": {
"subredditInfoByName": {
"__typename": "Subreddit",
"postFlairTemplates": [
{
"id": "f988392c-41f4-11ea-856e-0e3f43166111",
"isModOnly": false,
"richtext": null,
"text": "Arts/Crafts"
},
{
"id": "260873e0-c9b8-11e5-be06-0ecbb6f4dd8d",
"isModOnly": false,
"richtext": null,
"text": "Politics"
},
{
"id": "66cf8d7a-8718-11e9-803a-0e44312dcdb8",
"isModOnly": false,
"richtext": null,
"text": "Misleading Title"
},
"… 16 more items in the full response"
]
}
}
}
]探索更多
| API | 价格 | 响应 |
|---|---|---|
Reddit | $0.001 每次调用 | JSON |
Reddit | $0.001 每次调用 | JSON |
Reddit | $0.001 每次调用 | JSON |
Reddit | $0.001 每次调用 | JSON |
Reddit | $0.001 每次调用 | JSON |
Reddit | $0.001 每次调用 | JSON |
问题
向 https://api.sandbase.ai/v1/api/reddit/app/subreddit-post-channels 发送 POST 请求,在 Authorization 请求头中使用您的 SandBase API key(Bearer),并将参数作为 JSON 请求体传入。您也可以直接在本页的 Playground 中试用,无需编写代码。
每次调用 $0.001,从您的 SandBase 余额中扣费。您只需为实际调用付费;无需订阅。
无需参数。 可选:need_format (boolean), range (string), sort (string) 和 subreddit_name (string)。 Parameters 表和本页的 Playground 列出了每个字段。
在同一个 HTTP 请求中返回的 JSON 响应(同步)。 本页的 README 包含一个示例响应。
不需要。Reddit App Subreddit Post Channels 通过 SandBase 运行,因此一个 SandBase API key 即可覆盖此端点以及目录中的其他所有 API 和模型。您无需单独申请 Reddit API 访问权限。