[POST] 发送到货邮件
AI 概览
介绍可在一次请求中向一个或多个到货提醒订阅发送补货邮件的端点。
- 调用
POST /shop-api/back-in-stock/send-notify-restock,并附带必填的ids数组;速率限制为throttle:30,1。 - 将
allow_resend设置为 true,可向已发送过邮件的订阅重新发送。 - 响应列出
sent_count、sent_ids和skipped_ids(已发送、已取消订阅、无电子邮件或达到上限)。 - 达到邮件上限时,将失败并返回“Daily or monthly email limit reached”。
摘要由 AI 生成,可能有误,请以下方完整指南为准。
您可以在同一个请求中为单个或多个订阅发送到货邮件。
* 身份验证
必需 Authorization
限制 throttle:30,1
请求
端点 POST - /shop-api/back-in-stock/send-notify-restock
请求体负载
当 allow_resend 为 true 时,ID 列表中已发送过到货邮件的订阅将被重新发送。
| 参数 | 类型 | 是否必需 |
|---|---|---|
| ids | array | yes |
| allow_resend | sometimes|boolean | option |
POST /shop-api/back-in-stock/send-notify-restock HTTP/1.1Host: preorder.globo.ioContent-Type: application/jsonAuthorization: ************Content-Length: 49{ "ids": [1,2,3], "allow_resend": false}const myHeaders = new Headers();myHeaders.append("Content-Type", "application/json");myHeaders.append("Authorization", "************");const raw = JSON.stringify({ "ids": [1,2,3], "allow_resend": false});const requestOptions = { method: "POST", headers: myHeaders, body: raw, redirect: "follow"};fetch("https://preorder.globo.io/shop-api/back-in-stock/send-notify-restock", 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/send-notify-restock', 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 =>'{ "ids": [1,2,3], "allow_resend": false }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', 'Authorization: ************' ),));$response = curl_exec($curl);curl_close($curl);echo $response;成功响应 200
{ "success": true, "message": "Restock notification sent successfully", "data": { "sent_count": 2, // total submission sent "sent_ids": [12345, 12346], // IDs submission sent "skipped_ids": [12347], // IDs submission skipped (submission sent + allow_resend=false, unsubscribe, no email, limit...) "allow_resend": false }}失败
// Not found submission
{ "success": false, "message": "Not found submissions to send", "data": { "sent_count": 0, "skipped_ids": [12345] } }
// reach to limit
{ "success": false, "message": "Daily or monthly email limit reached" }
// id submission required
{ "success": false, "message": "The ids field is required." }
// catch
{ "success": false, "message": "Something went wrong" }
此页面对您有帮助吗?
感谢您的反馈! 告诉我们缺少了什么
报告问题