跳到內容
安裝應用程式
繁體中文

[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;

Payload 內容

參數類型必填
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,而非易讀的標籤。

進一步了解使用完整欄位表單產生訂閱者所需的內容。


成功回應 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"
}

這個頁面有幫助嗎?

回報問題