#Quickstart
You will create a property, tell Antero Connect what you sell and what it costs, take a booking, and read that booking back the way a hotel system does. Every command below was run against a real server to produce the answers shown.
Every call is shown in four languages. Pick yours with the tabs (curl, Python, JavaScript, PHP); the choice is remembered on every page. Nothing here needs more than that language: the curl tab also uses jq to keep an answer's field, and the Python tab uses requests. If you would rather click than type, the API reference lets you try each call in the browser, and the Postman collection has them all ready.
#1. Get an API key
A person with the owner or admin role signs in to Antero Connect panel and opens Settings › Developers › API keys. Choose a name and the permissions the key needs (for this quickstart: catalog, availability, reservations, webhooks), and copy the key. It is shown once. A key can never create other keys.
Put the address of your Antero Connect service and the key where your code can read them, and check that the key works and see what it may do:
export CHANNEL_MANAGER=https://api.anteromas.com # the address of your Channel Manager service
export KEY=cm_prod_ab12cd34_0123456789abcdef0123456789abcdef # your API key
curl -s -X GET "$CHANNEL_MANAGER/v1/whoami" \
-H "Authorization: Bearer $KEY"import os
import requests
CHANNEL_MANAGER = os.environ["CHANNEL_MANAGER"] # the address of your Channel Manager service
KEY = os.environ["KEY"] # your API key
r = requests.get(
f"{CHANNEL_MANAGER}/v1/whoami",
headers={"Authorization": f"Bearer {KEY}"},
)
r.raise_for_status()
print(r.status_code, r.text)// Node.js 18 or newer (fetch is built in); save as a .mjs file
const CHANNEL_MANAGER = process.env.CHANNEL_MANAGER; // the address of your Channel Manager service
const KEY = process.env.KEY; // your API key
let r; // the last answer
r = await fetch(`${CHANNEL_MANAGER}/v1/whoami`, {
method: "GET",
headers: { Authorization: `Bearer ${KEY}` },
});
if (!r.ok) throw new Error(await r.text());
console.log(r.status, await r.text());<?php
$CHANNEL_MANAGER = getenv("CHANNEL_MANAGER"); // the address of your Channel Manager service
$KEY = getenv("KEY"); // your API key
$ch = curl_init("{$CHANNEL_MANAGER}/v1/whoami");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer {$KEY}"],
]);
$out = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 400) { throw new RuntimeException($out); }
echo $status, " ", $out, "\n";{"tenant_id": "…", "key_id": "…", "scopes": ["read:catalog", "write:catalog", "read:ari", "write:ari", "read:reservations", "write:reservations"], "property_ids": []}property_ids empty means the key may use every property of the organization (all_properties says so in words). When you make a key you must choose: a list of property_ids, or all_properties: true; leaving both out is refused. The samples below use the variables the earlier steps made (PROPERTY_ID, and so on), so run them in order, in one session.
#2. Create a property
pms_authoritative means your system counts the rooms. The alternative is channel_manager_authoritative; see Availability and rates.
PROPERTY_ID=$(curl -s -X POST "$CHANNEL_MANAGER/v1/properties" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: qs-prop-1" \
-d @- <<EOF | jq -r '.id'
{
"name": "Villa Sunrise",
"timezone": "Asia/Makassar",
"currency": "USD",
"authority_mode": "pms_authoritative"
}
EOF
)r = requests.post(
f"{CHANNEL_MANAGER}/v1/properties",
headers={"Authorization": f"Bearer {KEY}", "Idempotency-Key": "qs-prop-1"},
json={
"name": "Villa Sunrise",
"timezone": "Asia/Makassar",
"currency": "USD",
"authority_mode": "pms_authoritative",
},
)
r.raise_for_status()
PROPERTY_ID = r.json()["id"]r = await fetch(`${CHANNEL_MANAGER}/v1/properties`, {
method: "POST",
headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json", "Idempotency-Key": "qs-prop-1" },
body: JSON.stringify({
name: "Villa Sunrise",
timezone: "Asia/Makassar",
currency: "USD",
authority_mode: "pms_authoritative",
}),
});
if (!r.ok) throw new Error(await r.text());
const PROPERTY_ID = (await r.json()).id;$ch = curl_init("{$CHANNEL_MANAGER}/v1/properties");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer {$KEY}", "Content-Type: application/json", "Idempotency-Key: qs-prop-1"],
CURLOPT_POSTFIELDS => json_encode([
"name" => "Villa Sunrise",
"timezone" => "Asia/Makassar",
"currency" => "USD",
"authority_mode" => "pms_authoritative",
]),
]);
$out = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 400) { throw new RuntimeException($out); }
$PROPERTY_ID = json_decode($out, true)["id"];#3. Say what you sell
A room type, and the rate plan that says how it is sold:
ROOM_TYPE_ID=$(curl -s -X POST "$CHANNEL_MANAGER/v1/properties/$PROPERTY_ID/room-types" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: qs-room-1" \
-d @- <<EOF | jq -r '.id'
{
"name": "Deluxe",
"code": "DLX",
"total_units": 6,
"max_occupancy": 3
}
EOF
)r = requests.post(
f"{CHANNEL_MANAGER}/v1/properties/{PROPERTY_ID}/room-types",
headers={"Authorization": f"Bearer {KEY}", "Idempotency-Key": "qs-room-1"},
json={
"name": "Deluxe",
"code": "DLX",
"total_units": 6,
"max_occupancy": 3,
},
)
r.raise_for_status()
ROOM_TYPE_ID = r.json()["id"]r = await fetch(`${CHANNEL_MANAGER}/v1/properties/${PROPERTY_ID}/room-types`, {
method: "POST",
headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json", "Idempotency-Key": "qs-room-1" },
body: JSON.stringify({
name: "Deluxe",
code: "DLX",
total_units: 6,
max_occupancy: 3,
}),
});
if (!r.ok) throw new Error(await r.text());
const ROOM_TYPE_ID = (await r.json()).id;$ch = curl_init("{$CHANNEL_MANAGER}/v1/properties/{$PROPERTY_ID}/room-types");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer {$KEY}", "Content-Type: application/json", "Idempotency-Key: qs-room-1"],
CURLOPT_POSTFIELDS => json_encode([
"name" => "Deluxe",
"code" => "DLX",
"total_units" => 6,
"max_occupancy" => 3,
]),
]);
$out = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 400) { throw new RuntimeException($out); }
$ROOM_TYPE_ID = json_decode($out, true)["id"];RATE_PLAN_ID=$(curl -s -X POST "$CHANNEL_MANAGER/v1/properties/$PROPERTY_ID/rate-plans" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: qs-plan-1" \
-d @- <<EOF | jq -r '.id'
{
"room_type_id": "$ROOM_TYPE_ID",
"name": "Standard rate",
"code": "STD"
}
EOF
)r = requests.post(
f"{CHANNEL_MANAGER}/v1/properties/{PROPERTY_ID}/rate-plans",
headers={"Authorization": f"Bearer {KEY}", "Idempotency-Key": "qs-plan-1"},
json={
"room_type_id": f"{ROOM_TYPE_ID}",
"name": "Standard rate",
"code": "STD",
},
)
r.raise_for_status()
RATE_PLAN_ID = r.json()["id"]r = await fetch(`${CHANNEL_MANAGER}/v1/properties/${PROPERTY_ID}/rate-plans`, {
method: "POST",
headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json", "Idempotency-Key": "qs-plan-1" },
body: JSON.stringify({
room_type_id: `${ROOM_TYPE_ID}`,
name: "Standard rate",
code: "STD",
}),
});
if (!r.ok) throw new Error(await r.text());
const RATE_PLAN_ID = (await r.json()).id;$ch = curl_init("{$CHANNEL_MANAGER}/v1/properties/{$PROPERTY_ID}/rate-plans");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer {$KEY}", "Content-Type: application/json", "Idempotency-Key: qs-plan-1"],
CURLOPT_POSTFIELDS => json_encode([
"room_type_id" => "{$ROOM_TYPE_ID}",
"name" => "Standard rate",
"code" => "STD",
]),
]);
$out = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 400) { throw new RuntimeException($out); }
$RATE_PLAN_ID = json_decode($out, true)["id"];#4. Push availability and prices
Six Deluxe rooms exist and five are free from 10 March to 16 March, at US$120.00 a night. date_to is included, so this range is seven nights, 10 to 16 March. Each push carries a pms_version, a number you raise with every push, which lets Antero Connect drop an old push that arrives late.
curl -s -X PUT "$CHANNEL_MANAGER/v1/properties/$PROPERTY_ID/availability" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: qs-av-1" \
-d @- <<EOF
{
"items": [
{
"room_type_id": "$ROOM_TYPE_ID",
"date_from": "2027-03-10",
"date_to": "2027-03-16",
"available": 5
}
],
"pms_version": 1
}
EOFr = requests.put(
f"{CHANNEL_MANAGER}/v1/properties/{PROPERTY_ID}/availability",
headers={"Authorization": f"Bearer {KEY}", "Idempotency-Key": "qs-av-1"},
json={
"items": [
{
"room_type_id": f"{ROOM_TYPE_ID}",
"date_from": "2027-03-10",
"date_to": "2027-03-16",
"available": 5,
},
],
"pms_version": 1,
},
)
r.raise_for_status()
print(r.status_code, r.text)r = await fetch(`${CHANNEL_MANAGER}/v1/properties/${PROPERTY_ID}/availability`, {
method: "PUT",
headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json", "Idempotency-Key": "qs-av-1" },
body: JSON.stringify({
items: [
{
room_type_id: `${ROOM_TYPE_ID}`,
date_from: "2027-03-10",
date_to: "2027-03-16",
available: 5,
},
],
pms_version: 1,
}),
});
if (!r.ok) throw new Error(await r.text());
console.log(r.status, await r.text());$ch = curl_init("{$CHANNEL_MANAGER}/v1/properties/{$PROPERTY_ID}/availability");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer {$KEY}", "Content-Type: application/json", "Idempotency-Key: qs-av-1"],
CURLOPT_POSTFIELDS => json_encode([
"items" => [
[
"room_type_id" => "{$ROOM_TYPE_ID}",
"date_from" => "2027-03-10",
"date_to" => "2027-03-16",
"available" => 5,
],
],
"pms_version" => 1,
]),
]);
$out = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 400) { throw new RuntimeException($out); }
echo $status, " ", $out, "\n";curl -s -X PUT "$CHANNEL_MANAGER/v1/properties/$PROPERTY_ID/rates" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: qs-rate-1" \
-d @- <<EOF
{
"items": [
{
"rate_plan_id": "$RATE_PLAN_ID",
"date_from": "2027-03-10",
"date_to": "2027-03-16",
"amount": 12000
}
],
"pms_version": 2
}
EOFr = requests.put(
f"{CHANNEL_MANAGER}/v1/properties/{PROPERTY_ID}/rates",
headers={"Authorization": f"Bearer {KEY}", "Idempotency-Key": "qs-rate-1"},
json={
"items": [
{
"rate_plan_id": f"{RATE_PLAN_ID}",
"date_from": "2027-03-10",
"date_to": "2027-03-16",
"amount": 12000,
},
],
"pms_version": 2,
},
)
r.raise_for_status()
print(r.status_code, r.text)r = await fetch(`${CHANNEL_MANAGER}/v1/properties/${PROPERTY_ID}/rates`, {
method: "PUT",
headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json", "Idempotency-Key": "qs-rate-1" },
body: JSON.stringify({
items: [
{
rate_plan_id: `${RATE_PLAN_ID}`,
date_from: "2027-03-10",
date_to: "2027-03-16",
amount: 12000,
},
],
pms_version: 2,
}),
});
if (!r.ok) throw new Error(await r.text());
console.log(r.status, await r.text());$ch = curl_init("{$CHANNEL_MANAGER}/v1/properties/{$PROPERTY_ID}/rates");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer {$KEY}", "Content-Type: application/json", "Idempotency-Key: qs-rate-1"],
CURLOPT_POSTFIELDS => json_encode([
"items" => [
[
"rate_plan_id" => "{$RATE_PLAN_ID}",
"date_from" => "2027-03-10",
"date_to" => "2027-03-16",
"amount" => 12000,
],
],
"pms_version" => 2,
]),
]);
$out = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 400) { throw new RuntimeException($out); }
echo $status, " ", $out, "\n";{"changed_days": 7, "unchanged_days": 0, "derived_changed_days": 0, "pms_version": 2, "released_holds": 0}Tried first, to see what would change, with no effect: add ?dry_run=true. Pushing the same thing twice changes nothing: unchanged_days says so.
#5. Take a booking
Price a stay without booking it, then book it. The quote writes nothing.
curl -s -X POST "$CHANNEL_MANAGER/v1/properties/$PROPERTY_ID/quote" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d @- <<EOF
{
"room_type_id": "$ROOM_TYPE_ID",
"arrival": "2027-03-11",
"departure": "2027-03-13",
"rooms": 1
}
EOFr = requests.post(
f"{CHANNEL_MANAGER}/v1/properties/{PROPERTY_ID}/quote",
headers={"Authorization": f"Bearer {KEY}"},
json={
"room_type_id": f"{ROOM_TYPE_ID}",
"arrival": "2027-03-11",
"departure": "2027-03-13",
"rooms": 1,
},
)
r.raise_for_status()
print(r.status_code, r.text)r = await fetch(`${CHANNEL_MANAGER}/v1/properties/${PROPERTY_ID}/quote`, {
method: "POST",
headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
room_type_id: `${ROOM_TYPE_ID}`,
arrival: "2027-03-11",
departure: "2027-03-13",
rooms: 1,
}),
});
if (!r.ok) throw new Error(await r.text());
console.log(r.status, await r.text());$ch = curl_init("{$CHANNEL_MANAGER}/v1/properties/{$PROPERTY_ID}/quote");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer {$KEY}", "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"room_type_id" => "{$ROOM_TYPE_ID}",
"arrival" => "2027-03-11",
"departure" => "2027-03-13",
"rooms" => 1,
]),
]);
$out = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 400) { throw new RuntimeException($out); }
echo $status, " ", $out, "\n";RESERVATION_ID=$(curl -s -X POST "$CHANNEL_MANAGER/v1/properties/$PROPERTY_ID/reservations" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: qs-res-1" \
-d @- <<EOF | jq -r '.id'
{
"room_type_id": "$ROOM_TYPE_ID",
"arrival": "2027-03-11",
"departure": "2027-03-13",
"rooms": 1,
"adults": 2,
"guest": {
"name": "Ana Lee",
"email": "ana.lee@example.com",
"phone": "+1 555 0100",
"country": "US"
},
"payment_status": "deposit"
}
EOF
)r = requests.post(
f"{CHANNEL_MANAGER}/v1/properties/{PROPERTY_ID}/reservations",
headers={"Authorization": f"Bearer {KEY}", "Idempotency-Key": "qs-res-1"},
json={
"room_type_id": f"{ROOM_TYPE_ID}",
"arrival": "2027-03-11",
"departure": "2027-03-13",
"rooms": 1,
"adults": 2,
"guest": {
"name": "Ana Lee",
"email": "ana.lee@example.com",
"phone": "+1 555 0100",
"country": "US",
},
"payment_status": "deposit",
},
)
r.raise_for_status()
RESERVATION_ID = r.json()["id"]r = await fetch(`${CHANNEL_MANAGER}/v1/properties/${PROPERTY_ID}/reservations`, {
method: "POST",
headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json", "Idempotency-Key": "qs-res-1" },
body: JSON.stringify({
room_type_id: `${ROOM_TYPE_ID}`,
arrival: "2027-03-11",
departure: "2027-03-13",
rooms: 1,
adults: 2,
guest: {
name: "Ana Lee",
email: "ana.lee@example.com",
phone: "+1 555 0100",
country: "US",
},
payment_status: "deposit",
}),
});
if (!r.ok) throw new Error(await r.text());
const RESERVATION_ID = (await r.json()).id;$ch = curl_init("{$CHANNEL_MANAGER}/v1/properties/{$PROPERTY_ID}/reservations");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer {$KEY}", "Content-Type: application/json", "Idempotency-Key: qs-res-1"],
CURLOPT_POSTFIELDS => json_encode([
"room_type_id" => "{$ROOM_TYPE_ID}",
"arrival" => "2027-03-11",
"departure" => "2027-03-13",
"rooms" => 1,
"adults" => 2,
"guest" => [
"name" => "Ana Lee",
"email" => "ana.lee@example.com",
"phone" => "+1 555 0100",
"country" => "US",
],
"payment_status" => "deposit",
]),
]);
$out = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 400) { throw new RuntimeException($out); }
$RESERVATION_ID = json_decode($out, true)["id"];The booking is confirmed, priced from the rates (two nights, 24000), and numbered KN-…. Because your system counts the rooms, Antero Connect holds one room for these nights until you confirm you counted it. Ask why a number is what it is:
curl -s -X GET "$CHANNEL_MANAGER/v1/properties/$PROPERTY_ID/availability/explain?room_type_id=$ROOM_TYPE_ID&date=2027-03-11" \
-H "Authorization: Bearer $KEY"r = requests.get(
f"{CHANNEL_MANAGER}/v1/properties/{PROPERTY_ID}/availability/explain?room_type_id={ROOM_TYPE_ID}&date=2027-03-11",
headers={"Authorization": f"Bearer {KEY}"},
)
r.raise_for_status()
print(r.status_code, r.text)r = await fetch(`${CHANNEL_MANAGER}/v1/properties/${PROPERTY_ID}/availability/explain?room_type_id=${ROOM_TYPE_ID}&date=2027-03-11`, {
method: "GET",
headers: { Authorization: `Bearer ${KEY}` },
});
if (!r.ok) throw new Error(await r.text());
console.log(r.status, await r.text());$ch = curl_init("{$CHANNEL_MANAGER}/v1/properties/{$PROPERTY_ID}/availability/explain?room_type_id={$ROOM_TYPE_ID}&date=2027-03-11");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer {$KEY}"],
]);
$out = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 400) { throw new RuntimeException($out); }
echo $status, " ", $out, "\n";{"room_type_id": "…", "date": "2027-03-11", "available": 5, "source": "api", "holds": [{"reservation_id": "…", "external_id": "KN-G6MSB7", "connection_id": null, "qty": 1, "feed_seq": 1}], "held": 1, "effective": 4}You said 5, one is held, so channels are told 4. A held room is never released by time, only by your confirmation.
#6. Read the feed, and confirm
Every new or changed booking gets the next number in a feed that is only for your property. You read it from where you left off:
curl -s -X GET "$CHANNEL_MANAGER/v1/properties/$PROPERTY_ID/reservation-feed?after=0&limit=50" \
-H "Authorization: Bearer $KEY"r = requests.get(
f"{CHANNEL_MANAGER}/v1/properties/{PROPERTY_ID}/reservation-feed?after=0&limit=50",
headers={"Authorization": f"Bearer {KEY}"},
)
r.raise_for_status()
print(r.status_code, r.text)r = await fetch(`${CHANNEL_MANAGER}/v1/properties/${PROPERTY_ID}/reservation-feed?after=0&limit=50`, {
method: "GET",
headers: { Authorization: `Bearer ${KEY}` },
});
if (!r.ok) throw new Error(await r.text());
console.log(r.status, await r.text());$ch = curl_init("{$CHANNEL_MANAGER}/v1/properties/{$PROPERTY_ID}/reservation-feed?after=0&limit=50");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer {$KEY}"],
]);
$out = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 400) { throw new RuntimeException($out); }
echo $status, " ", $out, "\n";{"data": [{"seq": 1, "kind": "created", "reservation_id": "…", "external_id": "KN-G6MSB7", "created_at": "…", "reservation": {…}, "guest": {…}}], "head": 1, "applied_through": 0}Store the booking in your system, then say how far you have got by sending feed_applied_through with your next availability push. Antero Connect releases the holds up to that number, and your own count now includes the room (four free, not five):
curl -s -X PUT "$CHANNEL_MANAGER/v1/properties/$PROPERTY_ID/availability" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: qs-av-2" \
-d @- <<EOF
{
"items": [
{
"room_type_id": "$ROOM_TYPE_ID",
"date_from": "2027-03-10",
"date_to": "2027-03-16",
"available": 4
}
],
"feed_applied_through": 1,
"pms_version": 3
}
EOFr = requests.put(
f"{CHANNEL_MANAGER}/v1/properties/{PROPERTY_ID}/availability",
headers={"Authorization": f"Bearer {KEY}", "Idempotency-Key": "qs-av-2"},
json={
"items": [
{
"room_type_id": f"{ROOM_TYPE_ID}",
"date_from": "2027-03-10",
"date_to": "2027-03-16",
"available": 4,
},
],
"feed_applied_through": 1,
"pms_version": 3,
},
)
r.raise_for_status()
print(r.status_code, r.text)r = await fetch(`${CHANNEL_MANAGER}/v1/properties/${PROPERTY_ID}/availability`, {
method: "PUT",
headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json", "Idempotency-Key": "qs-av-2" },
body: JSON.stringify({
items: [
{
room_type_id: `${ROOM_TYPE_ID}`,
date_from: "2027-03-10",
date_to: "2027-03-16",
available: 4,
},
],
feed_applied_through: 1,
pms_version: 3,
}),
});
if (!r.ok) throw new Error(await r.text());
console.log(r.status, await r.text());$ch = curl_init("{$CHANNEL_MANAGER}/v1/properties/{$PROPERTY_ID}/availability");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer {$KEY}", "Content-Type: application/json", "Idempotency-Key: qs-av-2"],
CURLOPT_POSTFIELDS => json_encode([
"items" => [
[
"room_type_id" => "{$ROOM_TYPE_ID}",
"date_from" => "2027-03-10",
"date_to" => "2027-03-16",
"available" => 4,
],
],
"feed_applied_through" => 1,
"pms_version" => 3,
]),
]);
$out = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 400) { throw new RuntimeException($out); }
echo $status, " ", $out, "\n";Two details that make this safe: reading again from the same after gives the same entries, and nothing is lost if your program stops anywhere between the steps. Integrating a PMS turns this into a loop that survives crashes.
#7. Be told instead of asking
Register an address and Antero Connect calls it, signed, when the feed has something new:
curl -s -X POST "$CHANNEL_MANAGER/v1/properties/$PROPERTY_ID/webhook-endpoints" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d @- <<EOF
{
"url": "https://pms.example.com/hooks/channel-manager"
}
EOFr = requests.post(
f"{CHANNEL_MANAGER}/v1/properties/{PROPERTY_ID}/webhook-endpoints",
headers={"Authorization": f"Bearer {KEY}"},
json={
"url": "https://pms.example.com/hooks/channel-manager",
},
)
r.raise_for_status()
print(r.status_code, r.text)r = await fetch(`${CHANNEL_MANAGER}/v1/properties/${PROPERTY_ID}/webhook-endpoints`, {
method: "POST",
headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
url: "https://pms.example.com/hooks/channel-manager",
}),
});
if (!r.ok) throw new Error(await r.text());
console.log(r.status, await r.text());$ch = curl_init("{$CHANNEL_MANAGER}/v1/properties/{$PROPERTY_ID}/webhook-endpoints");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer {$KEY}", "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"url" => "https://pms.example.com/hooks/channel-manager",
]),
]);
$out = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 400) { throw new RuntimeException($out); }
echo $status, " ", $out, "\n";The answer carries the signing secret once. See Webhooks to check the signature.
#Where next
- Conventions: idempotency, pagination, versions, dates and money in one place.
- Errors: every code and what to do about it.
- Best practices: how often to call, how to retry, how to batch.
- The API reference for every operation, with its schema and an example.