跳转到内容
安装应用
简体中文

[POST] 创建订阅

AI 概览

介绍为客户和多属性创建到货提醒订阅的端点。

  • 调用 POST /shop-api/back-in-stock/create;速率限制为 throttle:30,1。
  • customer_email、product_id 和 variant_id 为必填;customer_phone、locale、note 和 content 为可选。
  • 与表单字段 ID 不匹配的 content 键会被丢弃;请添加 content.keyLabel,以便后台和导出显示易读的标签。
  • 如果订阅已存在,消息为“Submission updated successfully”;已为该多属性注册的客户会收到错误。

摘要由 AI 生成,可能有误,请以下方完整指南为准。

* 身份验证

必需 Authorization

限制 throttle:30,1

请求

端点 POST - /shop-api/back-in-stock/create

POST /shop-api/back-in-stock/create HTTP/1.1
Host: preorder.globo.io
Content-Type: application/json
Authorization: ************
Content-Length: 84
{
"product_id":123456789,
"variant_id":123456789,
"customer_email": "[email protected]"
}
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "••••••");
const raw = JSON.stringify({
"product_id": 1,
"variant_id": 1,
"customer_email": "[email protected]"
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://preorder.globo.io/shop-api/back-in-stock/create", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://preorder.globo.io/shop-api/back-in-stock/create',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"product_id": 123456789,
"variant_id": 987654321,
"customer_email": "[email protected]"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: ************'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

请求体负载

参数类型是否必需
customer_emailemailyes
product_idnumberyes
variant_idnumberyes
customer_phonephone +9123456789no
localestring enno
notestringno
contentobjectno
content.keyLabelobjectno
  1. content:自定义字段值。请参阅下方的映射表。任何与 GET /form 返回的字段 id 不匹配的键(且不是 source 或 keyLabel)在保存前都会被静默丢弃。
  2. content.keyLabel 您所发送的自定义字段的 { fieldId: label } 映射。强烈建议提供 — 否则商家的后台界面和 CSV 导出将显示原始字段 id,而不是易读的标签。

了解有关使用完整字段表单生成订阅者所需 content 的更多信息。


成功响应 200

{
"success": true,
"message": "Submission created successfully", // "Submission updated successfully" if submission exist
"data": {
"id": 12345, // ID submission
"product_id": 1234567890, // Shopify product ID
"variant_id": 9876543210, // Shopify variant ID
"customer_email": "[email protected]",
"customer_phone": null,
"product_title": "Product Name",
"variant_title": "Size M / Blue",
"sku": "SKU-001",
"inventory_id": "45678901234", // Shopify inventory_item_id
"status": 0, // 0 => pending
"last_sent": null, // => pending
"unsubscribe": 0, // 0 => subscribe
"content": "{\"source\":\"api\"}", // JSON string (nullable)
"locale": "default",
"opened": 0, // Chưa mở email
"clicked": 0, // Chưa click link email
"note": null,
"created_at": "2026-07-06T10:00:00.000000Z",
"updated_at": "2026-07-06T10:00:00.000000Z"
}
}

失败

// Missing ID
{
"success": false,
"message": "product_id and variant_id are required"
}
// Not email
{
"success": false,
"message": "customer_email is required"
}
// variant not found
{
"success": false,
"message": "Variant not found"
}
// registered
{
"success": false,
"message": "Customer is already registered for this variant"
}
// catch
{
"success": false,
"message": "Something went wrong"
}

此页面对您有帮助吗?

报告问题