可以生成姓氏头像
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| key | string | 是 | 接口调用密钥 | |
| msg | string | 否 | 生成文字内容 | 蔡 |
| id1 | string | 否 | 图片型号ID 默认1020 | 1020 |
| id5 | string | 否 | 字体虚影颜色,默认#FFFFFF | #FFFFFF |
| id6 | string | 否 | #0000FF | |
| type | string | 否 | json |
[
{
"name": "key",
"type": "string",
"required": true,
"description": "接口调用密钥",
"example": ""
},
{
"name": "msg",
"type": "string",
"required": false,
"description": "生成文字内容",
"example": "蔡"
},
{
"name": "id1",
"type": "string",
"required": false,
"description": "图片型号ID 默认1020",
"example": "1020"
},
{
"name": "id5",
"type": "string",
"required": false,
"description": "字体虚影颜色,默认#FFFFFF",
"example": "#FFFFFF"
},
{
"name": "id6",
"type": "string",
"required": false,
"description": "",
"example": "#0000FF"
},
{
"name": "type",
"type": "string",
"required": false,
"description": "",
"example": "json"
}
]
{
"openapi": "3.1.1",
"info": {
"title": "姓氏头像",
"description": "可以生成姓氏头像",
"version": "1.0.0"
},
"paths": {
"/api/yljk/ysqm/ystx/api.php": {
"get": {
"summary": "姓氏头像",
"description": "可以生成姓氏头像",
"parameters": [
{
"name": "key",
"in": "query",
"required": true,
"schema": {
"type": "string"
},
"description": "接口调用密钥"
},
{
"name": "msg",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "蔡"
},
"description": "生成文字内容"
},
{
"name": "id1",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "1020"
},
"description": "图片型号ID 默认1020"
},
{
"name": "id5",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "#FFFFFF"
},
"description": "字体虚影颜色,默认#FFFFFF"
},
{
"name": "id6",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "#0000FF"
}
},
{
"name": "type",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "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": "msg",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "蔡"
},
"description": "生成文字内容"
},
{
"name": "id1",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "1020"
},
"description": "图片型号ID 默认1020"
},
{
"name": "id5",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "#FFFFFF"
},
"description": "字体虚影颜色,默认#FFFFFF"
},
{
"name": "id6",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "#0000FF"
}
},
{
"name": "type",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "json"
}
}
],
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
}
},
"servers": [
{
"url": "https://api.317ak.com",
"description": "当前访问入口(https)"
}
]
}
{
"msg": "获取成功",
"img_url": "http://21.jiqie.cn/106/114.132.201.221_0930031803.jpg",
"text": "可爱女孩",
"request_id": "1020",
"actual_id": 1020
}
姓氏头像接口用于生成个性化姓氏头像内容。适用于需要快速生成头像图片的娱乐类应用场景。接口提供免费调用服务。
https://api-v2.317ak.com/api/yljk/ysqm/ystx/api.php
支持请求方式:GET、POST
接口调用需要提供密钥。
首选鉴权方式:Query 参数鉴权。
请求时在调用地址后添加 key 参数,例如:key=你的密钥。
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| key | string | 是 | 接口调用密钥 |
| msg | string | 否 | 生成文字内容,例如:蔡 |
| id1 | string | 否 | 图片型号 ID,默认值为 1020 |
| id5 | string | 否 | 字体虚影颜色,默认值为 #FFFFFF |
| id6 | string | 否 | 字体颜色设置,例如:#0000FF |
| type | string | 否 | 返回格式设置,例如:json |
参数取值说明:
type 可设置为 json,用于指定返回数据格式。id1 用于选择头像图片型号,未传入时使用默认型号。{
"msg": "获取成功",
"img_url": "http://21.jiqie.cn/106/114.132.201.221_0930031803.jpg",
"text": "可爱女孩",
"request_id": "1020",
"actual_id": 1020
}
| 字段 | 类型 | 说明 |
|---|---|---|
| msg | string | 请求处理结果说明 |
| img_url | string | 生成头像图片地址 |
| text | string | 生成图片中的文字内容 |
| request_id | string | 请求使用的图片型号标识 |
| actual_id | integer | 实际生成使用的图片型号 ID |
{"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 -G "https://api-v2.317ak.com/api/yljk/ysqm/ystx/api.php" \
--data-urlencode "key=你的接口密钥" \
--data-urlencode "msg=蔡" \
--data-urlencode "id1=1020" \
--data-urlencode "type=json"
// PHP
## 注意事项
- 请妥善保管接口调用密钥,避免将 `key` 直接暴露在公开页面、前端代码或可被他人获取的位置,以防止接口被未授权调用。
- 调用接口时需通过 Query 参数传递密钥,即使用 `key=...` 进行鉴权,请确保参数名称和密钥内容填写正确。
- 建议使用 HTTPS 方式请求接口,保护请求过程中的参数信息安全。
- `msg` 用于设置生成的文字内容,可根据需求传入姓氏或其他短文本内容;未传入时将使用接口默认处理方式。
- `id1` 为图片型号 ID,默认值为 `1020`。如需指定其他图片样式,请传入有效的型号 ID,避免因参数错误导致生成失败。
- `id5` 用于设置字体虚影颜色,默认颜色为 `#FFFFFF`;颜色参数建议使用标准十六进制颜色格式。
- `id6` 为可选颜色配置参数,传入时请确保颜色格式正确。
- `type` 可用于指定返回格式,示例值为 `json`。如需解析返回内容,建议根据实际传入的格式处理响应数据。
- 接口为免费调用,但仍应合理控制请求频率,避免短时间内大量重复请求影响正常使用。
- 返回成功时可通过 `img_url` 获取生成的头像图片地址,请妥善处理返回数据,并根据业务场景保存或展示图片内容。curl -G "https://api-v2.317ak.com/api/yljk/ysqm/ystx/api.php" \
--data-urlencode "key=YOUR_API_KEY" \
--data-urlencode "msg=蔡" \
--data-urlencode "id1=1020" \
--data-urlencode "type=json"