随机返回一条历史文案
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| 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/lswa/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/lswa/api.php
支持 GET、POST 请求。
接口调用需要提供密钥。
首选鉴权方式:Query 参数鉴权。
请求时在调用地址后添加 key 参数,例如:
key=你的接口调用密钥
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| key | string | 是 | 接口调用密钥,需通过 Query 参数传递 |
| 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/lswa/api.php?key=你的密钥&type=json"
// PHP
$url = "https://api-v2.317ak.com/api/wz/lswa/api.php?key=你的密钥&type=json";
$response = file_get_contents($url);
echo $response;
key 为必填项,缺少该参数将无法正常调用接口。type 用于指定返回格式,可选值为 json、text,未传入时默认返回 json 格式,请根据业务场景选择合适的格式。#!/bin/bash
# 历史文案
url="https://api-v2.317ak.com/api/wz/lswa/api.php"
curl -G "$url" \
--data-urlencode "key=YOUR_API_KEY" \
--data-urlencode "type=json"
# GET调用
exit