API服务-中电数媒-数字电网新门户

🆓 免费版

¥0/月
  • ✅ 每小时100次请求
  • ✅ 基础API接口
  • ✅ 分类查询
  • ✅ 文章搜索
  • ❌ 高级搜索
  • ❌ 批量导出
  • ❌ 优先支持
推荐

⭐ 高级版

¥99/月
  • ✅ 每小时10,000次请求
  • ✅ 全部API接口
  • ✅ 高级搜索
  • ✅ 批量导出
  • ✅ 优先技术支持
  • ✅ 自定义字段
  • ✅ API使用统计

📋 API功能介绍

📊

数据统计

获取完整的法律法规统计数据,包括文章数量、分类统计等

🔍

全文搜索

支持标题和内容的全文搜索,快速定位相关法律法规

📋

分类浏览

按分类浏览法律法规,支持分页获取,数据结构清晰

📖

文章详情

获取完整的法律法规文章内容,包括发布时间、分类信息等

👤

用户管理

完善的用户权限管理,支持API密钥生成、使用统计等

💳

在线支付

支持支付宝、微信支付,自动激活高级版权限

📖 API文档

🔑 认证

所有API请求都需要在HTTP头部包含API密钥:

X-API-Key: your-api-key-here

📋 接口列表

生成API密钥

POST
POST /wp-json/law-api/v1/api-key
请求参数:
  • type: free 或 premium
  • user_id: WordPress用户ID
  • user_email: 用户邮箱

获取分类列表

GET
GET /wp-json/law-api/v1/categories

获取分类文章

GET
GET /wp-json/law-api/v1/categories/{id}/articles
查询参数:
  • page: 页码(默认1)
  • per_page: 每页数量(默认20,最大100)

获取文章详情

GET
GET /wp-json/law-api/v1/articles/{id}

搜索文章

GET
GET /wp-json/law-api/v1/search?q=关键词

获取统计信息

GET
GET /wp-json/law-api/v1/stats

💻 代码示例

PHP示例

<?php
// 获取API密钥
$response = wp_remote_post(home_url('/wp-json/law-api/v1/api-key'), array(
    'body' => json_encode(array(
        'type' => 'free',
        'user_id' => 1,
        'user_email' => 'user@example.com'
    )),
    'headers' => array('Content-Type' => application/json')
));

$api_key = json_decode(wp_remote_retrieve_body($response))->data->api_key;

// 获取分类列表
$response = wp_remote_get(home_url('/wp-json/law-api/v1/categories'), array(
    'headers' => array('X-API-Key' => $api_key)
));

$categories = json_decode(wp_remote_retrieve_body($response), true);
print_r($categories);
?>

JavaScript示例

// 获取API密钥
const response = await fetch('https://pipbest.cn/wp-json/law-api/v1/api-key', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
        type: 'free',
        user_id: 1,
        user_email: 'user@example.com'
    })
});

const { api_key } = await response.json();

// 获取分类列表
const categories = await fetch('https://pipbest.cn/wp-json/law-api/v1/categories', {
    headers: { 'X-API-Key': api_key }
});

const data = await categories.json();
console.log(data);

Python示例

import requests

# 获取API密钥
response = requests.post('https://pipbest.cn/wp-json/law-api/v1/api-key', 
                        json={'type': 'free', 'user_id': 1, 'user_email': 'user@example.com'})
api_key = response.json()['data']['api_key']

# 获取分类列表
headers = {'X-API-Key': api_key}
response = requests.get('https://pipbest.cn/wp-json/law-api/v1/categories', 
                       headers=headers)
categories = response.json()['data']
print(categories)

cURL示例

# 获取API密钥
curl -X POST https://pipbest.cn/wp-json/law-api/v1/api-key \
  -H "Content-Type: application/json" \
  -d '{"type": "free", "user_id": 1, "user_email": "user@example.com"}'

# 获取分类列表
curl -X GET https://pipbest.cn/wp-json/law-api/v1/categories \
  -H "X-API-Key: your-api-key-here"

📊 平台统计

4,908
法律法规文章
42
法律分类
7
API接口
99.9%
服务可用性