素材目录
素材目录提供产品源素材、背景、环境、图形库条目、设计模板和样机素材。列表端点返回精简的描述信息,详情端点包含文件清单。
| 类型 | 说明 |
|---|---|
products | 基础产品素材、预览、3D 模型、材质和纹理描述信息。 |
backgrounds | Viewer 静态背景。 |
environments | 环境贴图和预览图像。 |
image_library | 图形库素材,包括店铺范围内的图形。 |
design_templates | 设计模板预览和图层文件引用。支持 product_id 筛选。 |
mockups | 样机生成器素材、背景和叠加贴图。支持 product_id 筛选。 |
请求示例(fetch)
const assets = await alterFetch('/assets?' + new URLSearchParams({
type: 'products',
limit: '20',
offset: '0',
search: 'mug'
}));
const details = await alterFetch('/assets/products/4');
const fileResponse = await fetch(
'https://alterproduct.com/public-api/v1/assets/products/4/files/preview_medium',
{
headers: authHeaders
}
);
const fileBlob = await fileResponse.blob();响应示例
{
"type": "products",
"items": [
{
"assetType": "products",
"assetId": "4",
"title": "Mug 450ml",
"slug": "product-4",
"description": "Base product 4",
"primaryRole": "preview_big",
"fileCount": 8,
"remoteVersion": "1.0",
"thumbnail": {
"role": "preview_small",
"fileName": "product-4-preview-small.png",
"mime": "image/png",
"downloadPath": "/v1/assets/products/4/files/preview_small"
},
"metadata": {
"productCategoryId": 2,
"productModelCount": 1,
"isDedicated": false
}
}
],
"total": 1,
"limit": 20,
"offset": 0
}