随机返回一段诗词语录段子。
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| key | string | 是 | 接口调用密钥 | |
| type | string | 否 | 返回格式,默认json可选text、json | json |
[
{
"name": "key",
"type": "string",
"required": true,
"description": "接口调用密钥",
"example": ""
},
{
"name": "type",
"type": "string",
"required": false,
"description": "返回格式,默认json可选text、json",
"example": "json"
}
]
{
"openapi": "3.1.1",
"info": {
"title": "诗词语录",
"description": "随机返回一段诗词语录段子。",
"version": "1.0.0"
},
"paths": {
"/api/wz/scyl/api.php": {
"get": {
"summary": "诗词语录",
"description": "随机返回一段诗词语录段子。",
"parameters": [
{
"name": "key",
"in": "query",
"required": true,
"schema": {
"type": "string"
},
"description": "接口调用密钥"
},
{
"name": "type",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "json"
},
"description": "返回格式,默认json可选text、json"
}
],
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
},
"post": {
"summary": "诗词语录",
"description": "随机返回一段诗词语录段子。",
"parameters": [
{
"name": "key",
"in": "query",
"required": true,
"schema": {
"type": "string"
},
"description": "接口调用密钥"
},
{
"name": "type",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "json"
},
"description": "返回格式,默认json可选text、json"
}
],
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
}
},
"servers": [
{
"url": "https://api.317ak.com",
"description": "当前访问入口(https)"
}
]
}
{
"text": "长江千里,烟淡水云阔。 ──李纲《六么令·次韵和贺方回金陵怀古鄱阳席上作》"
}
随机返回一段诗词语录内容,适用于需要展示诗词、名句等随机文本的应用场景。
开发者可通过接口获取诗词语录数据,用于语录分类相关功能。
https://api-v2.317ak.com/api/wz/scyl/api.php
GET、POST
接口调用需要密钥认证,请在 Query 参数中传递密钥:
key=…
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| key | string | 是 | 接口调用密钥 |
| type | string | 否 | 返回格式,默认 json,可选 text、json |
{
"text": "长江千里,烟淡水云阔。 ──李纲《六么令·次韵和贺方回金陵怀古鄱阳席上作》"
}
| 字段 | 类型 | 说明 |
|---|---|---|
| text | string | 返回的诗词语录内容,包含诗词文本及来源信息。 |
请求失败时,接口返回 JSON 格式错误信息,示例如下:
{
"code": 0,
"msg": "未提供调用密钥",
"errcode": 11001
}
| errcode | 含义 |
|---|---|
| 11001 | 未提供调用密钥 |
| 11002 | 密钥错误 |
| 11003 | 密钥已禁用 |
| 11004 | 积分余额不足 |
| 11005 | 请求过于频繁(QPM 限制) |
| 11006 | 接口维护中 |
| 11007 | 接口已禁用 |
| 11008 | 接口不可用 |
| 11009 | 密钥校验暂不可用 |
| 11010 | 积分系统暂不可用 |
| 11011 | 收费接口须提供有效密钥 |
| 11012 | 鉴权方式错误 |
| 11013 | 接口不存在 |
| 11014 | ***地址无效 |
| 11015 | ***地址不允许 |
| 11016 | ***请求失败 |
| 11017 | 服务暂不可用 |
| 11018 | 请求方式不允许 |
| 11019 | 当前IP不在白名单内 |
| 11020 | 启用出口代理须提供有效密钥 |
| 11021 | 未配置可用出口代理 |
| 11022 | 出口代理不可用 |
| 11023 | 密钥已过期 |
| 11024 | 令牌分配积分不足 |
curl "https://api-v2.317ak.com/api/wz/scyl/api.php?key=YOUR_KEY&type=json"
// PHP
$url = "https://api-v2.317ak.com/api/wz/scyl/api.php?key=YOUR_KEY&type=json";
$response = file_get_contents($url);
echo $response;
key 参数传递有效密钥,密钥缺失或无效时可能无法正常获取诗词语录内容。type 参数为可选项,未传入时默认返回 JSON 格式;如需文本格式,请传入对应取值。curl "https://api-v2.317ak.com/api/wz/scyl/api.php?key=YOUR_API_KEY&type=json"