curl -X POST "https://api.scanova.io/qr-assets/design-template/" \
-H "Authorization: 401f7ac837da42b97f613d789819ff93537bee6a" \
-H "Content-Type: application/json" \
-d '{
"name": "Blue Gradient",
"resource_type": "qr_category",
"category": 3,
"design_info": { "bg": "#0033ff" },
"gradient_type": "linear",
"is_template": true
}'
{
"id": 9,
"name": "Blue Gradient",
"resource_type": "qr_category",
"category": 3,
"design_info": { "bg": "#0033ff" },
"gradient_type": "linear",
"color_palette": null,
"font_styles": null,
"is_template": true,
"info": null,
"template_id": null
}
QR 资源
创建用户设计模板
POST /qr-assets/design-template/
POST
/
qr-assets
/
design-template
/
curl -X POST "https://api.scanova.io/qr-assets/design-template/" \
-H "Authorization: 401f7ac837da42b97f613d789819ff93537bee6a" \
-H "Content-Type: application/json" \
-d '{
"name": "Blue Gradient",
"resource_type": "qr_category",
"category": 3,
"design_info": { "bg": "#0033ff" },
"gradient_type": "linear",
"is_template": true
}'
{
"id": 9,
"name": "Blue Gradient",
"resource_type": "qr_category",
"category": 3,
"design_info": { "bg": "#0033ff" },
"gradient_type": "linear",
"color_palette": null,
"font_styles": null,
"is_template": true,
"info": null,
"template_id": null
}
在 Management API 主机(
api.scanova.io)上为某个 QR 分类或表单保存一个新的设计模板,使用您的原始 Management API 密钥进行身份验证。
POST https://api.scanova.io/qr-assets/design-template/
Authorization: 401f7ac837da42b97f613d789819ff93537bee6a
string
必填
模板名称,最多 150 个字符。
string
默认值:"qr_category"
qr_category 或 form。integer
此模板所属的
QRCategory id。当 resource_type 为 qr_category 时必填;当 resource_type 为 form 时必须省略。object
任意 JSON 设计数据。
string
渐变样式,例如
linear。string
调色板,通常以 JSON 字符串编码。
string
字体样式数据。
boolean
默认值:"false"
将此记录标记为可重复使用的模板,而非一次性保存。
curl -X POST "https://api.scanova.io/qr-assets/design-template/" \
-H "Authorization: 401f7ac837da42b97f613d789819ff93537bee6a" \
-H "Content-Type: application/json" \
-d '{
"name": "Blue Gradient",
"resource_type": "qr_category",
"category": 3,
"design_info": { "bg": "#0033ff" },
"gradient_type": "linear",
"is_template": true
}'
{
"id": 9,
"name": "Blue Gradient",
"resource_type": "qr_category",
"category": 3,
"design_info": { "bg": "#0033ff" },
"gradient_type": "linear",
"color_palette": null,
"font_styles": null,
"is_template": true,
"info": null,
"template_id": null
}
resource_type 与 category 的配对规则
resource_type=qr_category 时 category 为必填,resource_type=form 时则禁止提供——序列化器和数据库检查约束都强制执行此规则,因此不会出现不一致。如果搞反了,会返回 400,附带 {"category": "This field is required for qr_category templates."} 或相反的错误信息。
相关内容
- 列出用户设计模板——查看已保存的模板。
- 更新用户设计模板——编辑现有模板。
- Management API 概览——适用于此端点的身份验证方案和配额规则。
授权
Send your Management API key as the raw value of the Authorization header — no "Bearer " or "Token " prefix, and no other characters. Example: Authorization: 401f7ac837da42b97f613d789819ff93537bee6a. A header containing more than one space-separated part is rejected outright. Requests also require the request's Host header to be the management API host (e.g. api.scanova.io) — the same key sent to the regular API host will not authenticate.
响应
Template created.
此页面对您有帮助吗?