Antero Connect Docs

#Best practices

Habits that make an integration calm. None is a rule of the API; each is the way things went well for people who built on it.

#Calls

  • Batch. One push of 500 items beats 500 pushes of one. A push of many days for a room type is one item with a range, not one item per day, when the value is the same.
  • Push what changed, or the whole picture. Never guess. If you are unsure what Antero Connect holds (after a crash, a restore, a long outage), push the whole picture for the nights you sell. Pushing a value that is already there is free (unchanged_days).
  • Try first with dry_run=true whenever a person confirms before the change is made, and before a large batch.
  • Ask for the range you need. A calendar screen needs calendar for the days on screen (at most 62), not a year of everything.
  • Keep ids; do not search by name. Store the id of the property, room types and rate plans in your system next to your own ids. Codes (DLX) are unique per property and good for people, but an id never changes.

#Idempotency and retries

  • Make every write idempotent. Send an Idempotency-Key on every POST, PUT, PATCH. Build it from what the work is (res-KN-G6MSB7-cancel), or save a UUID before you send. A key made fresh for each retry protects nothing.
  • Retry the right things. 429, 500, 502, 503, 504 and a connection that broke before an answer: wait and send the same request again, with the same key and bytes. Do not retry 400, 401, 403, 404, 409 unchanged: they will answer the same.
  • Back off with a little randomness. 1, 2, 4, 8 … seconds up to a minute, plus a random fraction, so many clients do not come back together. Honour Retry-After.
  • Set a timeout (30 seconds is generous) and treat a timeout as "unknown, send it again", which idempotency makes safe.

#Knowing when something happened

  • Prefer a webhook to polling, and keep a slow poll too. A webhook tells you when to read the feed; a read every minute or two is your safety net if a webhook is lost. See Webhooks.
  • Treat the feed as the truth and the webhook as a nudge. Never build state from a webhook body.
  • Be ready to read the same thing twice. Apply feed entries by external_id; the second time must change nothing.
  • Do not treat a gap in seq as an error. Numbers grow and may skip.

#Keeping your state

  • Save work and position together. The bookings you took over and the feed cursor are one write, or a crash will apply a booking twice or never.
  • Write a push down before sending it, and resend the same bytes until Antero Connect accepts them. See Integrating a PMS.
  • Record the request_id of every failed call in your log. It is the one thing that lets someone find the call at Antero Connect's end.
  • Keep a watchdog. If your cycle has not completed for a few minutes, tell a person. A silent integration is the expensive kind.

#Safety

  • Keys stay on servers. Never in a page, an app or a repository. See Authentication.
  • Least scopes. A reporting tool gets read:reservations, not write:ari. Use read:reservations.personal only for a system that really needs the guest.
  • One key per system, named for it, so you can revoke one without breaking the rest.
  • Verify every webhook before acting, on the raw bytes, in constant time.
  • Do not log guest data. The guest field is personal data. Keep it out of logs and error reports.
  • Treat money as integers. Never use floating point for an amount; use the smallest unit and the currency the answer gives.

#Testing

  • Build against the simulator channel (channel_code: "sim") and a property of your own with sandbox: true: it behaves like a real channel, failures included, and touches nothing real.
  • Test the bad days: your program killed mid-cycle, an answer lost, a stale version, a booking for a room type you do not know. The reference loop is tested for each.
  • Use dry_run and quote as free questions. They write nothing.
  • Use the Postman collection to poke at the API by hand; it carries the same examples as this documentation.