通过企鹅号获取他人头像
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| key | string | 是 | 接口调用密钥 | |
| string | 是 | 获取头像的企鹅号 | 3121871622 | |
| s | string | 否 | 头像的大小 | 640 |
[
{
"name": "key",
"type": "string",
"required": true,
"description": "接口调用密钥",
"example": ""
},
{
"name": "qq",
"type": "string",
"required": true,
"description": "获取头像的企鹅号",
"example": "3121871622"
},
{
"name": "s",
"type": "string",
"required": false,
"description": "头像的大小",
"example": "640"
}
]
{
"openapi": "3.1.1",
"info": {
"title": "获取企鹅头像",
"description": "通过企鹅号获取他人头像",
"version": "1.0.0"
},
"paths": {
"/api/QQ/qqlogo/api.php": {
"get": {
"summary": "获取企鹅头像",
"description": "通过企鹅号获取他人头像",
"parameters": [
{
"name": "key",
"in": "query",
"required": true,
"schema": {
"type": "string"
},
"description": "接口调用密钥"
},
{
"name": "qq",
"in": "query",
"required": true,
"schema": {
"type": "string",
"example": "3121871622"
},
"description": "获取头像的企鹅号"
},
{
"name": "s",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "640"
},
"description": "头像的大小"
}
],
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
},
"post": {
"summary": "获取企鹅头像",
"description": "通过企鹅号获取他人头像",
"parameters": [
{
"name": "key",
"in": "query",
"required": true,
"schema": {
"type": "string"
},
"description": "接口调用密钥"
},
{
"name": "qq",
"in": "query",
"required": true,
"schema": {
"type": "string",
"example": "3121871622"
},
"description": "获取头像的企鹅号"
},
{
"name": "s",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "640"
},
"description": "头像的大小"
}
],
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
}
},
"servers": [
{
"url": "https://api.317ak.com",
"description": "当前访问入口(https)"
}
]
}
通过企鹅号获取他人头像信息,适用于需要获取企鹅头像资源的应用场景。
该接口提供头像查询服务,开发者可通过接口调用获取对应头像。
https://api-v2.317ak.com/api/QQ/qqlogo/api.php
GET、POST
接口调用需要密钥。
首选鉴权方式:Query 参数。
请求时需携带 key 参数,例如 key=…。
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| key | string | 是 | 接口调用密钥 |
| string | 是 | 获取头像的企鹅号 | |
| s | string | 否 | 头像的大小,示例值:640 |
参数取值说明:
s 用于设置返回头像尺寸,可根据需求传入对应大小值。{
"code": 200,
"msg": "success",
"data": {
"url": "头像图片地址"
}
}
| 字段 | 类型 | 说明 |
|---|---|---|
| code | int | 请求状态标识 |
| msg | string | 请求结果说明 |
| data | object | 返回数据内容 |
| data.url | 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/QQ/qqlogo/api.php?key=你的密钥&qq=3121871622&s=640"
// PHP
$url = "https://api-v2.317ak.com/api/QQ/qqlogo/api.php?key=你的密钥&qq=3121871622&s=640";
$response = file_get_contents($url);
echo $response;
key 进行鉴权,请确保请求中携带有效密钥,否则可能无法正常调用。qq 参数为必填项,请填写有效的企鹅号;参数错误或无效号码可能导致无法获取对应头像。s 参数用于设置头像尺寸,可根据实际使用场景传入合适值;未传入时使用接口默认处理方式。# 获取企鹅头像
curl -G "https://api-v2.317ak.com/api/QQ/qqlogo/api.php" \
--data-urlencode "key=YOUR_API_KEY" \
--data-urlencode "qq=3121871622" \
--data-urlencode "s=640"