cURL
curl "https://api.ruseo.cn/api/pexels_image?action=search&query=nature&page=1&per_page=20&size=medium&orientation=landscape"
搜索和获取高质量免费图片,支持关键词搜索、随机图片、热门图片,图片可商用
https://api.ruseo.cn/api/pexels_image
接口调用前需要确认的核心配置。
/api/pexels_imagepexels_image必填参数必须传入,示例值可直接用于联调。
免费API不强制要求API Key,但如果您希望统计个人调用次数,请在请求时附加参数 key=您的API_KEY。
注册账号后即可获得API Key。
| 参数名 | 必填 | 类型 | 说明 | 示例值 |
|---|---|---|---|---|
key |
否 | string | 可选参数:携带此参数可统计您的个人调用次数。请注册账号获取API Key。 | YOUR_API_KEY |
action |
否 | string | 操作类型:search(搜索)、random(随机精选)、popular(热门),默认random | search |
query |
否 | string | 搜索关键词(action=search时必填) | nature |
page |
否 | int | 页码,默认1 | 1 |
per_page |
否 | int | 每页数量,默认15,最大80 | 20 |
size |
否 | string | 图片尺寸:original、large、medium、small、tiny,默认large | medium |
orientation |
否 | string | 图片方向:landscape(横)、portrait(竖)、square(正方形) | landscape |
优先使用示例地址测试请求参数是否正确。
https://api.ruseo.cn/api/pexels_image?action=search&query=nature&page=1&per_page=20&size=medium&orientation=landscape
curl "https://api.ruseo.cn/api/pexels_image?action=search&query=nature&page=1&per_page=20&size=medium&orientation=landscape"
$url = 'https://api.ruseo.cn/api/pexels_image?action=search&query=nature&page=1&per_page=20&size=medium&orientation=landscape';
$response = file_get_contents($url);
$data = json_decode($response, true);
fetch('https://api.ruseo.cn/api/pexels_image?action=search&query=nature&page=1&per_page=20&size=medium&orientation=landscape')
.then(res => res.json())
.then(data => console.log(data));
实际返回内容以接口脚本处理结果为准。
{
"code": 0,
"msg": "success",
"data": {
"route": "pexels_image",
"example": true
}
}
| 参数名 | 类型 | 说明 | 示例值 |
|---|---|---|---|
total |
int | 总数量 | 50000 |
page |
int | 当前页码 | 1 |
per_page |
int | 每页数量 | 15 |
photos |
array | 图片列表 | [{...}] |
photos[].id |
int | 图片ID | 12345 |
photos[].url |
string | 图片链接 | https://images.pexels.com/... |
photos[].photographer |
string | 摄影师 | John Doe |
点击左侧“发送请求”查看结果...