通过输入内容来生成二维码。
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| key | string | 是 | 接口调用密钥 | |
| text | string | 是 | 二维码内容 | 倾梦 |
| size | string | 是 | 二维码大小 | 300 |
[
{
"name": "key",
"type": "string",
"required": true,
"description": "接口调用密钥",
"example": ""
},
{
"name": "text",
"type": "string",
"required": true,
"description": "二维码内容",
"example": "倾梦"
},
{
"name": "size",
"type": "string",
"required": true,
"description": "二维码大小",
"example": "300"
}
]
{
"openapi": "3.1.1",
"info": {
"title": "二维码生成",
"description": "通过输入内容来生成二维码。",
"version": "1.0.0"
},
"paths": {
"/api/yljk/scewm/api.php": {
"get": {
"summary": "二维码生成",
"description": "通过输入内容来生成二维码。",
"parameters": [
{
"name": "key",
"in": "query",
"required": true,
"schema": {
"type": "string"
},
"description": "接口调用密钥"
},
{
"name": "text",
"in": "query",
"required": true,
"schema": {
"type": "string",
"example": "倾梦"
},
"description": "二维码内容"
},
{
"name": "size",
"in": "query",
"required": true,
"schema": {
"type": "string",
"example": "300"
},
"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": "text",
"in": "query",
"required": true,
"schema": {
"type": "string",
"example": "倾梦"
},
"description": "二维码内容"
},
{
"name": "size",
"in": "query",
"required": true,
"schema": {
"type": "string",
"example": "300"
},
"description": "二维码大小"
}
],
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
}
},
"servers": [
{
"url": "https://api-v2.317ak.com",
"description": "当前访问入口(https)"
}
]
}
通过输入指定内容生成二维码,适用于需要快速创建二维码的调用场景。
接口提供二维码生成能力,方便开发者在应用中集成使用。
https://api-v2.317ak.com/api/yljk/scewm/api.php
GET、POST
本接口调用需要密钥鉴权,请在请求参数中通过 Query 方式传递 key 参数完成鉴权。
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| key | string | 是 | 接口调用密钥 |
| text | string | 是 | 二维码内容,例如:倾梦 |
| size | string | 是 | 二维码大小,例如:300 |
text:填写需要生成二维码的文本内容。size:填写二维码尺寸大小,示例值 300 表示生成对应尺寸的二维码。{
"code": 200,
"msg": "success",
"data": {
"qrcode": "二维码图片地址或内容"
}
}
| 字段 | 类型 | 说明 |
|---|---|---|
| code | int | 请求处理状态 |
| msg | string | 请求处理提示信息 |
| data | object | 成功返回的数据内容 |
| data.qrcode | 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 -G "https://api-v2.317ak.com/api/yljk/scewm/api.php" \
--data-urlencode "key=你的接口密钥" \
--data-urlencode "text=倾梦" \
--data-urlencode "size=300"
// PHP
## 注意事项
- 调用接口前请妥善保管接口密钥,避免将密钥直接暴露在公开页面、客户端代码或可被他人获取的位置。
- 本接口通过 Query 参数 `key` 进行鉴权,请按照要求传入有效密钥,否则无法正常调用。
- 请求地址请使用 HTTPS 方式访问,确保传输过程中的数据安全。
- `text` 参数用于指定二维码生成内容,不能为空。建议在提交前确认内容格式符合预期,避免生成无效二维码。
- `size` 参数用于设置二维码尺寸,请传入合适的数值。尺寸过小可能影响识别效果,尺寸过大可能增加处理时间。
- 请根据实际使用场景合理控制调用频率,避免短时间内大量重复请求影响接口正常使用。
- 本接口为免费接口,但仍建议按照正常业务需求使用,避免无意义或高频调用。
- 接口返回内容请根据实际响应结果进行处理,使用前建议做好异常情况兼容。curl "https://api-v2.317ak.com/api/yljk/scewm/api.php?key=YOUR_API_KEY&text=%E5%80%BE%E6%A2%A6&size=300"