Menu/restriction-batches

Write Restrictions of Properties over date ranges

POST/api/v1/restriction-batches
Nécessite restrictions.write

Stores 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-Keystring

    Replaying 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 with dry_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[]obligatoire

    1 à 20000 éléments

    Afficher 4 attributs enfants
    • property_idstring (uuid)obligatoire
    • fromstring (date)obligatoire

      First night, inclusive.

    • tostring (date)obligatoire

      Last night, inclusive.

    • valuesRestrictionValuesobligatoire

      The values to write on every date of the entry; a field left out is not touched. At least one field.

      Afficher 5 attributs enfants
      • ratenumber

        Base 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_stayinteger

        Minimum stay in nights.

        min 1 · max 365

      • closed_to_arrivalboolean
      • closed_to_departureboolean
      • availabilityboolean

        Open (true) or close (false) the night for sale. A booked night stays closed on the Sales Channels whatever this value.

  • dry_runboolean

    When true, nothing is stored or sent: the answer is 200 with what would change per Property.

Réponses

200With dry_run: what the batch would change now.

application/jsonRestrictionBatchPreview

  • dry_runtrueobligatoire
  • propertiesRestrictionBatchPreviewProperty[]obligatoire
    Afficher 4 attributs enfants
    • property_idstring (uuid)obligatoire
    • changesobjectobligatoire

      Date × field changes of this Property.

      Afficher 4 attributs enfants
      • submittedintegerobligatoire
      • changedintegerobligatoire
      • unchangedintegerobligatoire
      • refusedintegerobligatoire
    • changedRestrictionChangePreview[]obligatoire

      Every change that would be sent, in date order.

      Afficher 4 attributs enfants
      • datestring (date)obligatoire
      • fieldstringobligatoire

        Parmi : rate min_stay closed_to_arrival closed_to_departure availability

      • currentnumber | boolean | nullobligatoire

        The value now; null when unset or not in the calendar.

      • newnumber | boolean | nullobligatoire
    • refused_fieldsRefusedField[]obligatoire
      Afficher 4 attributs enfants
      • fieldstringobligatoire

        Parmi : rate min_stay closed_to_arrival closed_to_departure availability

      • reasonstringobligatoire

        Parmi : manual_override managed_by_another_pricing_tool blocked_by_linked_property

      • fromstring (date)obligatoire
      • tostring (date)obligatoire
202The batch is stored and queued.

application/jsonRestrictionBatchAccepted

  • idstring (uuid)obligatoire
  • statusstringobligatoire

    queued then processing while 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 : queued processing completed partially_failed failed cancelled

401Error code: unauthorized, connection_revoked.

Codes d’erreur

  • unauthorized Le 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_revoked Le 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_blocked L’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_suspended ZenHost a suspendu votre App, ou ne l’autorise plus sur ce compte. Cessez les appels et contactez ZenHost.
  • forbidden_permission Votre 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_failed La requête, les en-têtes ou le corps sont invalides ; details.issues désigne chaque problème (path, message, et maximum quand une valeur ou une liste est trop grande).
  • property_out_of_scope Un logement demandé est hors du périmètre de connexion ; details.property_ids les liste.
  • idempotency_key_reused Cette Idempotency-Key a 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_limited Trop d’appels sur cette connexion d’App. Attendez le nombre de secondes indiqué dans Retry-After.
500Error code: internal_error.

Codes d’erreur

  • internal_error ZenHost n’a pas pu répondre. Réessayez plus tard avec un délai croissant.

Tous les codes d’erreur et la conduite à tenir