构建 · 无代码自动化
无需编写代码即可实现商品目录自动化
一句话总结
无代码运行流程:通过一个 HTTP 节点提交一批商品图片,等待 3 秒,读取批处理状态,重复该过程直至完成,然后将 URLs 写回您的表格。
- Credits: 2K 分辨率 4 credits · 4K 分辨率 5 credits
- 常规耗时: 1.5–4 min per image
- 处理方式: 异步,轮询
本页所有数据均来自 Photta API 文档 · 已验证
一个 HTTP 节点、一个等待节点和一个条件节点。n8n、Make 或任何支持 HTTP 的工具都可以通过 batch endpoint 处理整个产品目录。
RESPONSE=$(curl -s -X POST https://api.photta.app/api/v1/ghost-mannequin/batch \
-H "Authorization: Bearer $PHOTTA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"product_images": [
{
"image": "https://cdn.yourstore.com/products/jacket-front.jpg",
"back_image": "https://cdn.yourstore.com/products/jacket-back.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/shirt-front.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/trousers-front.jpg",
"image_side": "front"
}
],
"style": "3d",
"background_color": "white",
"resolution": "2K",
"aspect_ratio": "3:4",
"user_instruction": "closed front, buttoned up",
"brand_label_id": "7cc9f988-068b-44cd-8004-22f486b10e67"
}')
ID=$(echo "$RESPONSE" | jq -r '.data.id')const res = await fetch("https://api.photta.app/api/v1/ghost-mannequin/batch", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PHOTTA_API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
"product_images": [
{
"image": "https://cdn.yourstore.com/products/jacket-front.jpg",
"back_image": "https://cdn.yourstore.com/products/jacket-back.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/shirt-front.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/trousers-front.jpg",
"image_side": "front"
}
],
"style": "3d",
"background_color": "white",
"resolution": "2K",
"aspect_ratio": "3:4",
"user_instruction": "closed front, buttoned up",
"brand_label_id": "7cc9f988-068b-44cd-8004-22f486b10e67"
}),
});
const { data } = await res.json(); // data.id, data.statusimport os, requests
res = requests.post(
"https://api.photta.app/api/v1/ghost-mannequin/batch",
headers={"Authorization": f"Bearer {os.environ['PHOTTA_API_KEY']}"},
json={
"product_images": [
{
"image": "https://cdn.yourstore.com/products/jacket-front.jpg",
"back_image": "https://cdn.yourstore.com/products/jacket-back.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/shirt-front.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/trousers-front.jpg",
"image_side": "front"
}
],
"style": "3d",
"background_color": "white",
"resolution": "2K",
"aspect_ratio": "3:4",
"user_instruction": "closed front, buttoned up",
"brand_label_id": "7cc9f988-068b-44cd-8004-22f486b10e67"
},
)
data = res.json()["data"] # data["id"], data["status"]工作原理
输入电子表格,输出图片文件夹
导出产品目录,配置一个 HTTP 节点,带等待时间地循环轮询,将 URLs 写回。
步骤 1
导出产品目录
每件服装占一行,并附带公开可访问的图片 URL。该列是 batch endpoint 所需的唯一步输入。
步骤 2
获取 Photta API key
将其保存在自动化工具的凭据库(credential vault)中,而非写入节点体内部,这样导出的工作流就不会泄露密钥。
步骤 3
配置 HTTP 节点
使用 POST 请求、Bearer 请求头以及此处展示的 JSON 请求体。数组中的每个元素代表一件服装;样式字段将应用于所有服装。
步骤 4
带等待的轮询循环
等待 3 秒,读取批处理状态,检查 status 是否为 complete,然后继续下一次轮询。该间隔时间遵循官方文档建议。
步骤 5
遵守速率限制与额度上限
批处理大小上限和并发批处理上限均取决于您的计划。请提交一个批次,待其完成后再提交下一个批次。
步骤 6
写回 URLs
批处理完成后,每个条目都会返回专属的输出 URL。在同一次运行中直接将它们写入表格并下载文件。
节点及其配置内容
请求体直接采用 API 文档中发布的示例;循环间隔即文档中规定的轮询间隔。
{
"product_images": [
{
"image": "https://cdn.yourstore.com/products/jacket-front.jpg",
"back_image": "https://cdn.yourstore.com/products/jacket-back.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/shirt-front.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/trousers-front.jpg",
"image_side": "front"
}
],
"style": "3d",
"background_color": "white",
"resolution": "2K",
"aspect_ratio": "3:4",
"user_instruction": "closed front, buttoned up",
"brand_label_id": "7cc9f988-068b-44cd-8004-22f486b10e67"
}RESPONSE=$(curl -s -X POST https://api.photta.app/api/v1/ghost-mannequin/batch \
-H "Authorization: Bearer $PHOTTA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"product_images": [
{
"image": "https://cdn.yourstore.com/products/jacket-front.jpg",
"back_image": "https://cdn.yourstore.com/products/jacket-back.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/shirt-front.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/trousers-front.jpg",
"image_side": "front"
}
],
"style": "3d",
"background_color": "white",
"resolution": "2K",
"aspect_ratio": "3:4",
"user_instruction": "closed front, buttoned up",
"brand_label_id": "7cc9f988-068b-44cd-8004-22f486b10e67"
}')
ID=$(echo "$RESPONSE" | jq -r '.data.id'){
"nodes": [
{
"name": "Wait",
"type": "n8n-nodes-base.wait",
"parameters": {
"amount": 3,
"unit": "seconds"
}
},
{
"name": "Read batch",
"type": "n8n-nodes-base.httpRequest",
"parameters": {
"method": "GET",
"url": "https://api.photta.app/api/v1/ghost-mannequin/batch/{{ $json.data.batch_id }}"
}
},
{
"name": "Done?",
"type": "n8n-nodes-base.if",
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.data.status }}",
"value2": "completed"
}
]
}
}
}
]
}# 600 requests per minute per key, fixed window.
# One batch submission plus one poll every 3 seconds is ~21 requests per minute
# per batch in flight, so the concurrency cap binds long before the rate limit.
# On a 429, wait the Retry-After seconds (30 by default) before the next node runs.开发者常见问题
关于无代码运行的常见问题
我需要编写代码吗?
不需要。此处的全部操作都是带有 JSON 请求体的 HTTP 请求,任何自动化工具都能发送。您唯一需要输入的文本就是本页面所展示的请求体。
一次运行可以处理多少张图片?
API 批处理上限为:Free 和 Hobby 计划 5 张,Seller 计划 10 张,Brand 计划 25 张,Studio 计划 50 张。更大的目录可拆分为多个批次逐一运行。
如果单张图片处理失败会发生什么?
批次中的其余图片会继续处理。批处理响应体中会标明 completed 和 failed 的数量,失败条目的 credits 会自动退还。
这可以定时运行吗?
可以。设置为每晚触发工作流,自动抓取尚未生成图片的行。无论是人工手动启动还是定时触发,轮询循环完全一致。
这在 Make 或 Zapier 中可以使用吗?
只要平台支持发送带有请求头和 JSON 请求体的 HTTP 请求,并能在步骤之间设置等待即可。节点名称可能不同,但这三个核心步骤完全一致。