名人名言mingyan
返回一条名人名言,支持按类型筛选。action=types 可获取所有类型列表。
1. 基本信息
| 接口地址 | https://v1.apizero.cn/api/mingyan |
|---|---|
| 请求方法 | POST |
| 分类 | content |
| 提供方 | 极数本源 · ApiZero |
| 计费模式 | 免费试用 |
| 单次消耗 | 0 积分 |
| 起步价 | — |
| QPS 限制 | 5 req/s |
| 每日免费额度 | 50 次(已认证用户) |
| 匿名每日额度 | 30 次(无 API Key) |
| VIP 免费 | 否 |
| 调用次数 |
2. 认证
携带 X-Api-Key 请求头可获得更高调用频度和更快速率
获取 API Key:登录 https://apizero.cn/account/keys
3. 请求参数
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
action | string | 否 | 可选:'types' 列出所有类型 | — |
typeid | string | 否 | 名言类型 ID(数字) | — |
5. 请求示例
以下 5 种语言示例都是可直接运行的,只需把 YOUR_API_KEY 替换为实际 Key。
cURL
curl -X POST "https://v1.apizero.cn/api/mingyan" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"action": "<action>",
"typeid": "<typeid>"
}'Python
import requests
resp = requests.request(
"POST",
"https://v1.apizero.cn/api/mingyan",
headers={"X-Api-Key": "YOUR_API_KEY", "Content-Type": "application/json"},
json={
"action": "<action>",
"typeid": "<typeid>",
},
timeout=15,
)
resp.raise_for_status()
print(resp.json())JavaScript (Node.js)
// Node.js 18+ / 浏览器原生 fetch
const res = await fetch("https://v1.apizero.cn/api/mingyan", {
method: "POST",
headers: {
"X-Api-Key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
"action": "<action>",
"typeid": "<typeid>"
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
console.log(data);Go
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
body := []byte(`{"action":"<action>","typeid":"<typeid>"}`)
req, _ := http.NewRequest("POST", "https://v1.apizero.cn/api/mingyan", bytes.NewBuffer(body))
req.Header.Set("X-Api-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
}PHP
<?php
$payload = json_encode([
"action" => "<action>",
"typeid" => "<typeid>",
], JSON_UNESCAPED_UNICODE);
$ch = curl_init("https://v1.apizero.cn/api/mingyan");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => [
"X-Api-Key: YOUR_API_KEY",
"Content-Type: application/json",
],
CURLOPT_TIMEOUT => 15,
]);
$body = curl_exec($ch);
curl_close($ch);
$data = json_decode($body, true);
print_r($data);7. 响应示例
{
"code": 200,
"message": "success",
"data": {}
}