[POST] Vytvoření pravidla
Přehled od AI
Popisuje koncový bod, který vytvoří pravidlo „brzy dostupné" pro všechny produkty, kolekci, produkty nebo varianty.
- Zavolejte
POST /shop-api/coming-soon/create; limit požadavků jethrottle:30,1. name,start_dateaapply_tojsou povinné;end_datemusí být postart_date.apply_tojeall,collection,productnebovariant; pošleteproduct_idsnebovariant_ids(1 až 50) či jednocollection_id, které odpovídá.translationsje objekt pro každý jazyk s textem tlačítka a zprávami „brzy dostupné";show_countdownje volitelné.- Tabulka validace uvádí pravidla a možné chybové zprávy pro každé pole.
Shrnutí vytvořila AI. Může obsahovat chyby, proto si ověřte celý návod níže.
* Ověřování
Povinné Authorization
Limit throttle:30,1
Požadavek
Endpoint POST - /shop-api/coming-soon/create
Tělo požadavku (payload)
| Parametry | Typ | Povinné |
|---|---|---|
name | string | yes |
status | int 0 1 | no |
start_date | datetime | yes např. 2026-07-01T10:00:00.000000Z |
end_date | datetime | no |
apply_to | "all" | "collection" | "product" | "variant" | yes |
product_ids | array [1,2,...] | yes min:1|max:50 (pokud apply_to = product) |
variant_ids | array [1,2,...] | yes min:1|max:50 (pokud apply_to = variant) |
collection_id | number jedna kolekce | yes (pokud apply_to = collection) |
translations | object | no |
show_countdown | boolean true false | no |
apply_tomusí být jedna z hodnot"all""collection""product""variant"product_idsse nesmí odesílat, pokudapply_tonení"product", aproduct_idsmusí být polevariant_idsse nesmí odesílat, pokudapply_tonení"variant", avariant_idsmusí být polecollection_idse nesmí odesílat, pokudapply_tonení"collection", acollection_idmusí být platné IDtranslationsmusí být objekt, příklad:translations: {default: {comingSoonAddToCartText: "Coming Soon" // string}// en: {...}, jp: {...}}
POST /shop-api/coming-soon/create HTTP/1.1Host: preorder.globo.ioContent-Type: application/jsonAuthorization: ************Content-Length: 347{ "name": "Summer launch", "status": 1, "start_date": "2026-07-01T10:00:00.000000Z", "end_date": "2026-07-11T10:00:00.000000Z", "apply_to": "product", "product_ids": [10076972613912], "translations": { "default":{ "comingSoonAddToCartText":"Coming Soon", "comingSoonAboveMessage":"Product will available in ...", "comingSoonBellowMessage":"" }, "jp":{ "comingSoonAddToCartText":"Coming Soon", "comingSoonAboveMessage":"Product will available in ...", "comingSoonBellowMessage":"" } }}const myHeaders = new Headers();myHeaders.append("Content-Type", "application/json");myHeaders.append("Authorization", "************");
const raw = JSON.stringify({ "name": "Summer launch", "status": 1, "start_date": "2026-07-01T10:00:00.000000Z", "end_date": "2026-07-11T10:00:00.000000Z", "apply_to": "product", "product_ids": [10076972613912], "translations": { "default":{ "comingSoonAddToCartText":"Coming Soon", "comingSoonAboveMessage":"Product will available in ...", "comingSoonBellowMessage":"" }, "jp":{ "comingSoonAddToCartText":"Coming Soon", "comingSoonAboveMessage":"Product will available in ...", "comingSoonBellowMessage":"" } }});
const requestOptions = { method: "POST", headers: myHeaders, body: raw, redirect: "follow"};
fetch("https://preorder.globo.io/shop-api/coming-soon/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/coming-soon/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 =>'{ "name": "coming soon 1", "status": 0, "start_date": "2026-07-01T10:00:00.000000Z", "apply_to": "product", "product_ids": [10076972613912], "translations": { "default":{ "comingSoonAddToCartText":"Coming Soon", "comingSoonAboveMessage":"Product will available in ...", "comingSoonBellowMessage":"" }, "jp":{ "comingSoonAddToCartText":"Coming Soon", "comingSoonAboveMessage":"Product will available in ...", "comingSoonBellowMessage":"" } } }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', 'Authorization: ************' ),));$response = curl_exec($curl);curl_close($curl);echo $response;Úspěšná odpověď 200
{ "success": true, "message": "Coming soon product created", "data": { "id": 1, "name": "Summer launch", "start_date": "2026-07-01 10:00:00", "end_date": null, "show_countdown": null, "apply_to": "product", "product_ids": [10076972613912], "variant_ids": null, "collection_id": null, "translations": { "default": { "comingSoonAddToCartText": "Coming soon" } }, "status": 1, "created_at": "2026-07-16T07:00:00.000000Z", "updated_at": "2026-07-16T07:00:00.000000Z" }}Validace
| Pole | Pravidla | Možné chybové zprávy |
|---|---|---|
| name | required, string, max:255 | The name field is required. The name may not be greater than 255 characters. |
| status | required, in:0,1 | The status field is required. The selected status is invalid. |
| start_date | required, date | The start date field is required. The start date is not a valid date. |
| end_date | nullable, date, after:start_date | The end date is not a valid date. The end date must be a date after start date. |
| show_countdown | nullable, boolean | The show countdown field must be true or false. |
| apply_to | product,variant,collection,all | The apply to field is required. The selected apply to is invalid. |
| product_ids | required_if:apply_to,product, array | The product ids field is required when apply to is product. The product ids must be an array. |
| variant_ids | required_if:apply_to,variant, array | The variant ids field is required when apply to is variant. The variant ids must be an array. |
| collection_id | required_if:apply_to,collection | The collection id field is required when apply to is collection. |
| translations | nullable, array | The translations must be an array. |
| translations.{lang} | array | Each translation entry must be an array. |
| translations.{lang}.comingSoonAddToCartText | string | The translations.{lang}.comingSoonAddToCartText must be a string. |
| translations.{lang}.comingSoonAboveMessage | string | The translations.{lang}.comingSoonAboveMessage must be a string. |
| translations.{lang}.comingSoonBellowMessage | string | The translations.{lang}.comingSoonBellowMessage must be a string. |
Pomohla vám tato stránka?
Děkujeme za zpětnou vazbu! Napište nám, co chybělo
Nahlásit problém