Write Restrictions of Properties over date ranges
/api/v1/restriction-batchesrestrictions.writeStores the batch and answers at once; the changes then reach ZenHost and the Sales Channels shortly after, in submission order: on a date and field, the latest batch wins and an older change not sent yet is superseded. A value equal to the current one is not sent again. A field ZenHost will not write (Manual Override, another pricing tool, a night closed by a linked Property; see unwritable_fields of GET /restrictions) is refused and reported, never forced; the rest of the batch still applies, with no rollback. Read the outcome with GET /restriction-batches/{id}. Every POST, dry_run included, counts against the submission rate limit.
Paramètres
En-têtes
Idempotency-KeystringReplaying the same key on the same App Connection within 24 hours returns the batch it created instead of a new one. Reusing it with a different body answers
idempotency_key_reused. Ignored withdry_run.au plus 255 caractères
Corps de la requête
application/jsonRestrictionBatchRequest
Up to 20000 entries over at most 100 Properties (to cover more, send one batch per page of GET /properties). Dates run from today to today + 730 days, both in the time zone of each Property (its timezone).
entriesRestrictionBatchEntry[]obligatoire1 à 20000 éléments
Afficher 4 attributs enfantsMasquer les attributs enfants
property_idstring (uuid)obligatoirefromstring (date)obligatoireFirst night, inclusive.
tostring (date)obligatoireLast night, inclusive.
valuesRestrictionValuesobligatoireThe values to write on every date of the entry; a field left out is not touched. At least one field.
Afficher 5 attributs enfantsMasquer les attributs enfants
ratenumberBase nightly rate, decimal, in the currency of the Property, rounded to the cent. Property Pricing Modifiers still apply on top per Sales Channel.
min 0.01 · max 99999999.99
min_stayintegerMinimum stay in nights.
min 1 · max 365
closed_to_arrivalbooleanclosed_to_departurebooleanavailabilitybooleanOpen (
true) or close (false) the night for sale. A booked night stays closed on the Sales Channels whatever this value.
dry_runbooleanWhen
true, nothing is stored or sent: the answer is200with what would change per Property.
Réponses
200With dry_run: what the batch would change now.
application/jsonRestrictionBatchPreview
dry_runtrueobligatoirepropertiesRestrictionBatchPreviewProperty[]obligatoireAfficher 4 attributs enfantsMasquer les attributs enfants
property_idstring (uuid)obligatoirechangesobjectobligatoireDate × field changes of this Property.
Afficher 4 attributs enfantsMasquer les attributs enfants
submittedintegerobligatoirechangedintegerobligatoireunchangedintegerobligatoirerefusedintegerobligatoire
changedRestrictionChangePreview[]obligatoireEvery change that would be sent, in date order.
Afficher 4 attributs enfantsMasquer les attributs enfants
datestring (date)obligatoirefieldstringobligatoireParmi :
ratemin_stayclosed_to_arrivalclosed_to_departureavailabilitycurrentnumber | boolean | nullobligatoireThe value now;
nullwhen unset or not in the calendar.newnumber | boolean | nullobligatoire
refused_fieldsRefusedField[]obligatoireAfficher 4 attributs enfantsMasquer les attributs enfants
fieldstringobligatoireParmi :
ratemin_stayclosed_to_arrivalclosed_to_departureavailabilityreasonstringobligatoireParmi :
manual_overridemanaged_by_another_pricing_toolblocked_by_linked_propertyfromstring (date)obligatoiretostring (date)obligatoire
202The batch is stored and queued.
application/jsonRestrictionBatchAccepted
idstring (uuid)obligatoirestatusstringobligatoirequeuedthenprocessingwhile changes wait for the Sales Channels (each Property is sent at a pace the Sales Channels accept, and retried when they are unavailable); final:completed(nothing failed),partially_failed,failed(nothing applied),cancelled.Parmi :
queuedprocessingcompletedpartially_failedfailedcancelled
401Error code: unauthorized, connection_revoked.
Codes d’erreur
unauthorizedLe jeton d’accès est absent, inconnu, expiré ou révoqué, ou a été émis avant que le compte ne reconnecte l’App. Rafraîchissez-le ; si le rafraîchissement échoue, demandez au propriétaire de reconnecter l’App.connection_revokedLe propriétaire a révoqué la connexion d’App (ou votre App a révoqué son propre jeton de rafraîchissement). Cessez les appels pour ce compte et supprimez ses jetons.
402Error code: subscription_blocked.
Codes d’erreur
subscription_blockedL’abonnement ZenHost du compte est bloqué (impayé, résilié…). La connexion est conservée : prévenez votre client, les appels refonctionnent dès que l’abonnement est rétabli.
403Error code: app_suspended, forbidden_permission.
Codes d’erreur
app_suspendedZenHost a suspendu votre App, ou ne l’autorise plus sur ce compte. Cessez les appels et contactez ZenHost.forbidden_permissionVotre App n’a pas reçu la permission que cet endpoint exige.
422Error code: validation_failed, property_out_of_scope, idempotency_key_reused.
Codes d’erreur
validation_failedLa requête, les en-têtes ou le corps sont invalides ;details.issuesdésigne chaque problème (path,message, etmaximumquand une valeur ou une liste est trop grande).property_out_of_scopeUn logement demandé est hors du périmètre de connexion ;details.property_idsles liste.idempotency_key_reusedCetteIdempotency-Keya déjà été utilisée sur cette connexion d’App avec un autre corps.
429Error code: rate_limited.
En-tête Retry-After — Seconds to wait before the next call is allowed. Limits per App Connection: 60 reads (GET), 10 writes (other POST) and 30 messages sent to guests per minute.
Codes d’erreur
rate_limitedTrop d’appels sur cette connexion d’App. Attendez le nombre de secondes indiqué dansRetry-After.
500Error code: internal_error.
Codes d’erreur
internal_errorZenHost n’a pas pu répondre. Réessayez plus tard avec un délai croissant.