Get a Complete List of Attendees, Travel and More
Pull a complete filtered list, such as everyone registered or traveling for a show, page by page.
Example use case
You need a report of everyone registered or traveling for a show and want to collect every matching record.
What you'll end up with
A list of Staff registrations and Travel Reservations for one Event or the whole workspace. You can also filter the Travel list by tagged people.
Before you start
Have a workspace API key. If you plan to filter by people, get their IDs from Users and Resources.
Good to know
Leave out the Event filter to search the whole workspace, or add it to focus on one show.
At a glance
Time to try
About 5 minutes
Effect on your data
Read-only
Endpoints
2
The program reads Staff registrations and Travel Reservations and prints their IDs.
How it works
- The program reads Staff registrations and Travel Reservations. An Event ID narrows both lists.
- If you supply tagged people, it applies those filters to Travel and keeps the same filters on every page.
- It follows the paging fields and prints each distinct record ID and Event ID.
Read every matching record
The examples below use the Staff and Travel lists. The program reads Staff first, then Travel, and continues each list when there are more records.
Step 1: Read every page of attendees
Read Staff registrations a page at a time, with an optional Event filter.
curl -X GET "https://api.exhibitday.com/v1/events/staff?%24limit=2&%24offset=0" -H "Authorization: Bearer YOUR_API_KEY"
Example response (shortened)
{
"records_found": 2,
"total_records": 3,
"has_more": true,
"list_data": [
{
"id": 101,
"event_id": 5001
},
{
"id": 102,
"event_id": 5002
}
]
}
total_records is the number of matches across all pages.
Check: While has_more is true, increase $offset by the number of rows returned and request the next page.
Step 2: Read every page of travel reservations
Read Travel Reservations a page at a time, with optional Event and tagged-people filters.
curl -X GET "https://api.exhibitday.com/v1/events/travel_reservations?filter_by_tagged_user_ids=%5B%2211111111-2222-4333-8444-555555555555%22%2C%2266666666-7777-4888-8999-000000000000%22%5D&filter_by_tagged_user_ids_match_type=all&%24limit=2&%24offset=0" -H "Authorization: Bearer YOUR_API_KEY"
Example response (shortened)
{
"records_found": 2,
"total_records": 3,
"has_more": true,
"list_data": [
{
"id": 201,
"event_id": 5001
},
{
"id": 202,
"event_id": 5002
}
]
}
list_data[].id identifies a Travel Reservation. Keep each ID once, even if it appears on two pages.
Check: Use the same filters on every page. Stop when has_more is false.
Try it
Before running the example
| Variable | What to put in it | Required? |
|---|---|---|
EXHIBITDAY_API_KEY | Your workspace API key. | Yes |
EXHIBITDAY_PAGE_SIZE | A positive number of records per page. Defaults to 100. | No |
EXHIBITDAY_EVENT_ID | One Event ID to limit both lists. Leave it out for all readable Events in the workspace. | No |
EXHIBITDAY_TAGGED_USER_IDS_JSON | One person ID or a JSON array of IDs to filter Travel. | No |
EXHIBITDAY_TAG_MATCH_TYPE | Use any for at least one selected person, or all for every selected person. Defaults to any. | No |
Bash
export EXHIBITDAY_API_KEY='YOUR_API_KEY'
PowerShell
$env:EXHIBITDAY_API_KEY = 'YOUR_API_KEY'
Then copy the complete example program below in your language and run it.
Complete example program
#!/usr/bin/env bash
# Requires Bash, curl and Python3. No API key is written into the program.
python3 - <<'EXHIBITDAY_PY'
# Python 3; standard library only. Set EXHIBITDAY_API_KEY before running.
import http.client
import json
import os
import re
import time
import urllib.error
import urllib.parse
import urllib.request
BASE = "https://api.exhibitday.com/v1"
SPEC = json.loads("{\"preserveNumbers\":true,\"requests\":{\"staff_pages\":{\"method\":\"GET\",\"path\":\"/events/staff\"},\"travel_pages\":{\"method\":\"GET\",\"path\":\"/events/travel_reservations\"}}}")
API_KEY = os.environ["EXHIBITDAY_API_KEY"]
if any(ord(char) < 32 or ord(char) > 126 for char in API_KEY):
raise RuntimeError("Use the API key as one ASCII header value without control characters")
if not API_KEY.strip():
raise RuntimeError("Set EXHIBITDAY_API_KEY")
def decode_json(text):
if SPEC["preserveNumbers"]:
# Quote JSON NUMBER tokens, never text inside a JSON string, to keep CSV decimals exact.
text = re.sub(r'"(?:\\.|[^"\\])*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?',
lambda m: m[0] if m[0].startswith('"') else json.dumps(m[0]), text)
return json.loads(text)
from pathlib import Path
# This terminal version uses curl for HTTP and Python's standard library for JSON/CSV.
import subprocess
import tempfile
def transport(method, url, headers, data):
with tempfile.TemporaryDirectory(prefix="exhibitday-guide-") as directory:
folder = Path(directory)
# curl may leave no output file for a valid bodyless304 response.
(folder / "body").write_bytes(b"")
command = ["curl", "--disable", "--silent", "--show-error", "--request", method, "--url", url,
"--max-time", "30", "--dump-header", str(folder / "headers"),
"--output", str(folder / "body"), "--write-out", "%{http_code}"]
for name, value in headers.items():
command += ["--header", name + ": " + value]
if data is not None:
(folder / "request").write_bytes(data)
command += ["--data-binary", "@" + str(folder / "request")]
result = subprocess.run(command, capture_output=True, text=True)
if result.returncode:
raise urllib.error.URLError(result.stderr.strip())
response_headers = {}
blocks = (folder / "headers").read_text(encoding="iso-8859-1").replace("\r\n", "\n").strip().split("\n\n")
for line in blocks[-1].splitlines()[1:]:
name, separator, value = line.partition(":")
if separator:
response_headers[name] = value.strip()
return int(result.stdout), (folder / "body").read_bytes(), response_headers
class ApiError(RuntimeError):
"""An API error response. Branch on error_code (and status), never on the message text.
uncertain is True when a PATCH or DELETE got no response or a server error: it may or may not have been applied."""
def __init__(self, status, body, uncertain=False):
self.status = status
self.uncertain = uncertain
self.error_code = body.get("error_code") if isinstance(body, dict) else None
super().__init__(f"{body.get('error_code')} {body.get('error_params')}: {body.get('errors')} (request {body.get('request_id')})"
if isinstance(body, dict) else "HTTP " + str(status) if status else "No response")
def call(name, params=None, body=None, key=None):
route = SPEC["requests"][name]
headers = {"Authorization": "Bearer " + API_KEY, "Accept": "application/json"}
if route["method"] == "POST":
if not key: raise RuntimeError("Persist a logical create key before sending POST")
headers["Idempotency-Key"] = key
data = None if body is None else json.dumps(body).encode("utf-8")
if data is not None:
headers["Content-Type"] = "application/json"
query = urllib.parse.urlencode(params or {})
url = BASE + route["path"] + ("?" + query if query else "")
# Only GET has automatic retries in this workflow. A PATCH or DELETE that got no response or a
# server error is never resent blindly: it may already have been applied, so the caller reads the record first.
resend = route["method"] == "GET"
for attempt in range(5):
try:
status, raw, response_headers = transport(route["method"], url, headers, data)
except (urllib.error.URLError, TimeoutError, ConnectionError, http.client.HTTPException):
if not resend:
raise ApiError(0, None, uncertain=True)
if attempt == 4:
raise
time.sleep(2 ** attempt)
continue
response_headers = {k.lower(): v for k, v in response_headers.items()}
result = None
if status != 304 and raw:
try:
result = decode_json(raw.decode("utf-8"))
except (ValueError, UnicodeError):
if status < 400:
raise RuntimeError("Expected a JSON success response")
if status >= 500 and not resend:
raise ApiError(status, result, uncertain=True)
retry = resend and (status == 429 or status >= 500)
if retry:
if attempt == 4:
raise RuntimeError("Retry limit reached; check the request outcome before starting a new create")
delay = response_headers.get("retry-after", str(2 ** attempt))
time.sleep(max(0, float(delay)))
continue
if status >= 400:
raise ApiError(status, result)
return {"status": status, "body": result, "headers": response_headers, "raw": raw}
raise RuntimeError("Retry limit reached")
def add_offset(offset, received):
result = int(offset) + received
if received <= 0 or result > 2147483647: raise RuntimeError("Cannot advance this int32 offset; reconcile the query")
return str(result)
def concat(left, right):
return left + right
def items(value):
if not isinstance(value, list): raise RuntimeError("Expected a JSON array")
return value
def count(value):
return len(items(value))
def either(left, right):
if not isinstance(left, bool) or not isinstance(right, bool): raise RuntimeError("Expected Boolean criteria")
return left or right
def equal(left, right):
return type(left) is type(right) and left == right
def field(value, name):
if not isinstance(value, dict) or name not in value: raise RuntimeError("Missing response field: " + name)
return value[name]
def is_empty(value):
return count(value) == 0
def is_present(value):
return value is not None and value != ""
def new_id_set():
return set()
def not_value(value):
if not isinstance(value, bool): raise RuntimeError("Expected a Boolean")
return not value
def optional(name, fallback):
value = os.environ.get(name)
return fallback if value is None or value == "" else value
def page_size(value):
if not re.fullmatch(r"[1-9][0-9]*", value) or int(value) > 2147483647: raise RuntimeError("Page size must be a positive int32")
return value
def positive_id(value):
if not re.fullmatch(r"[1-9][0-9]*", value) or int(value) > 9223372036854775807: raise RuntimeError("Use a positive record ID")
return value
def print_value(value):
print(value if isinstance(value, str) else json.dumps(value, ensure_ascii=False))
def remember_id(seen, value):
if value in seen: return False
seen.add(value)
return True
def require_condition(value, message):
if value is not True: raise RuntimeError(message)
def text(value):
if value is None: return ""
if isinstance(value, str): return value
if isinstance(value, bool): return "true" if value else "false"
if isinstance(value, int): return str(value)
raise RuntimeError("Expected a scalar response value")
def main():
selected_page_size = page_size(optional("EXHIBITDAY_PAGE_SIZE", "100"))
selected_event_id = optional("EXHIBITDAY_EVENT_ID", "")
if is_present(selected_event_id):
selected_event_id = positive_id(selected_event_id)
tagged_user_filter = optional("EXHIBITDAY_TAGGED_USER_IDS_JSON", "")
tag_match_type = optional("EXHIBITDAY_TAG_MATCH_TYPE", "any")
require_condition(either(equal(tag_match_type, "any"), equal(tag_match_type, "all")), "Choose any or all for EXHIBITDAY_TAG_MATCH_TYPE.")
staff_query = {"$limit": selected_page_size}
if is_present(selected_event_id):
staff_query["filter_by_event_id"] = selected_event_id
staff_offset = "0"
staff_seen_ids = new_id_set()
print_value("Staff record ID\tEvent ID")
while True:
staff_query["$offset"] = staff_offset
staff_response = call("staff_pages", staff_query, None, None)
staff_page = staff_response["body"]
staff_rows = items(field(staff_page, "list_data"))
require_condition(equal(text(field(staff_page, "records_found")), text(count(staff_rows))), "records_found does not match this page's rows.")
require_condition(is_present(text(field(staff_page, "total_records"))), "The collection wrapper needs total_records.")
require_condition(either(equal(field(staff_page, "has_more"), True), equal(field(staff_page, "has_more"), False)), "Expected a Boolean has_more value.")
for staff_record in items(staff_rows):
staff_record_id = positive_id(text(field(staff_record, "id")))
staff_event_id = positive_id(text(field(staff_record, "event_id")))
if is_present(selected_event_id):
require_condition(equal(staff_event_id, selected_event_id), "A returned row belongs to a different Event.")
if remember_id(staff_seen_ids, staff_record_id):
print_value(concat(staff_record_id, concat("\t", staff_event_id)))
if equal(field(staff_page, "has_more"), False):
break
require_condition(not_value(is_empty(staff_rows)), "An empty page has has_more=true; stop and reconcile the query.")
staff_offset = add_offset(staff_offset, count(staff_rows))
travel_query = {"$limit": selected_page_size}
if is_present(selected_event_id):
travel_query["filter_by_event_id"] = selected_event_id
if is_present(tagged_user_filter):
travel_query["filter_by_tagged_user_ids"] = tagged_user_filter
travel_query["filter_by_tagged_user_ids_match_type"] = tag_match_type
travel_offset = "0"
travel_seen_ids = new_id_set()
print_value("Travel record ID\tEvent ID")
while True:
travel_query["$offset"] = travel_offset
travel_response = call("travel_pages", travel_query, None, None)
travel_page = travel_response["body"]
travel_rows = items(field(travel_page, "list_data"))
require_condition(equal(text(field(travel_page, "records_found")), text(count(travel_rows))), "records_found does not match this page's rows.")
require_condition(is_present(text(field(travel_page, "total_records"))), "The collection wrapper needs total_records.")
require_condition(either(equal(field(travel_page, "has_more"), True), equal(field(travel_page, "has_more"), False)), "Expected a Boolean has_more value.")
for travel_record in items(travel_rows):
travel_record_id = positive_id(text(field(travel_record, "id")))
travel_event_id = positive_id(text(field(travel_record, "event_id")))
if is_present(selected_event_id):
require_condition(equal(travel_event_id, selected_event_id), "A returned row belongs to a different Event.")
if remember_id(travel_seen_ids, travel_record_id):
print_value(concat(travel_record_id, concat("\t", travel_event_id)))
if equal(field(travel_page, "has_more"), False):
break
require_condition(not_value(is_empty(travel_rows)), "An empty page has has_more=true; stop and reconcile the query.")
travel_offset = add_offset(travel_offset, count(travel_rows))
if __name__ == "__main__":
main()
EXHIBITDAY_PY
// Server-side Node.js with fetch; built-in modules only. Set EXHIBITDAY_API_KEY.
const BASE = "https://api.exhibitday.com/v1";
const SPEC = JSON.parse("{\"preserveNumbers\":true,\"requests\":{\"staff_pages\":{\"method\":\"GET\",\"path\":\"/events/staff\"},\"travel_pages\":{\"method\":\"GET\",\"path\":\"/events/travel_reservations\"}}}");
const API_KEY = process.env.EXHIBITDAY_API_KEY;
if (!API_KEY || !API_KEY.trim()) throw new Error("Set EXHIBITDAY_API_KEY");
if (/[^\x20-\x7e]/.test(API_KEY)) throw new Error("Use the API key as one ASCII header value without control characters");
const sleep = milliseconds => new Promise(resolve => setTimeout(resolve, milliseconds));
function decodeJson(text) {
if (SPEC.preserveNumbers) {
// Keep raw JSON number tokens exact for CSV; quoted JSON strings remain unchanged.
text = text.replace(/"(?:\\.|[^"\\])*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,
token => token.startsWith('"') ? token : JSON.stringify(token));
}
return JSON.parse(text);
}
// An API error response. Branch on errorCode (and status), never on the message text.
// uncertain is true when a PATCH or DELETE got no response or a server error: it may or may not have been applied.
class ApiError extends Error {
constructor(status, result, uncertain = false) {
super(result ? JSON.stringify({ error_code: result.error_code, errors: result.errors,
error_params: result.error_params, request_id: result.request_id }) : status ? "HTTP " + status : "No response");
this.status = status;
this.errorCode = result ? result.error_code : undefined;
this.uncertain = uncertain;
}
}
async function call(name, params = {}, body = null, key = null) {
const route = SPEC.requests[name];
const headers = { Authorization: "Bearer " + API_KEY, Accept: "application/json" };
if (route.method === "POST") {
if (!key) throw new Error("Persist a logical create key before sending POST");
headers["Idempotency-Key"] = key;
}
const data = body === null ? undefined : JSON.stringify(body);
if (data !== undefined) headers["Content-Type"] = "application/json";
const query = new URLSearchParams(params).toString();
const url = BASE + route.path + (query ? "?" + query : "");
// Only GET has automatic retries in this workflow. A PATCH or DELETE that got no response or a
// server error is never resent blindly: it may already have been applied, so the caller reads the record first.
const resend = route.method === "GET";
for (let attempt = 0; attempt < 5; attempt++) {
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), 30000);
let response, raw;
try {
response = await fetch(url, { method: route.method, headers, body: data, signal: controller.signal, redirect: "error" });
raw = await response.text();
} catch (error) {
if (!resend) throw new ApiError(0, null, true);
if (attempt === 4) throw error;
await sleep(1000 * 2 ** attempt);
continue;
} finally { clearTimeout(timer); }
const resultHeaders = {};
response.headers.forEach((value, name) => { resultHeaders[name.toLowerCase()] = value; });
let result = null;
if (response.status !== 304 && raw) {
try { result = decodeJson(raw); }
catch (error) { if (response.status < 400) throw new Error("Expected a JSON success response"); }
}
if (response.status >= 500 && !resend) throw new ApiError(response.status, result, true);
const retry = resend && (response.status === 429 || response.status >= 500);
if (retry) {
if (attempt === 4) throw new Error("Retry limit reached; check the outcome before starting a new create");
const requested = Number(resultHeaders["retry-after"]);
await sleep(1000 * (Number.isFinite(requested) && requested >= 0 ? requested : 2 ** attempt));
continue;
}
if (response.status >= 400) throw new ApiError(response.status, result);
return { status: response.status, body: result, headers: resultHeaders, raw };
}
throw new Error("Retry limit reached");
}
function add_offset(offset, received) { const result = BigInt(offset) + received; if (received <= 0n || result > 2147483647n) throw new Error("Cannot advance this int32 offset; reconcile the query"); return result.toString(); }
function concat(left, right) { return left + right; }
function items(value) { if (!Array.isArray(value)) throw new Error("Expected a JSON array"); return value; }
function count(value) { return BigInt(items(value).length); }
function either(left, right) { if (typeof left !== "boolean" || typeof right !== "boolean") throw new Error("Expected Boolean criteria"); return left || right; }
function equal(left, right) { return typeof left === typeof right && left === right; }
function field(value, name) { if (!value || Array.isArray(value) || typeof value !== "object" || !Object.hasOwn(value, name)) throw new Error("Missing response field: " + name); return value[name]; }
function is_empty(value) { return count(value) === 0n; }
function is_present(value) { return value !== null && value !== undefined && value !== ""; }
function new_id_set() { return new Set(); }
function not_value(value) { if (typeof value !== "boolean") throw new Error("Expected a Boolean"); return !value; }
function optional(name, fallback) { const value = process.env[name]; return value === undefined || value === "" ? fallback : value; }
function page_size(value) { if (!/^[1-9][0-9]*$/.test(value) || BigInt(value) > 2147483647n) throw new Error("Page size must be a positive int32"); return value; }
function positive_id(value) { if (!/^[1-9][0-9]*$/.test(value) || BigInt(value) > 9223372036854775807n) throw new Error("Use a positive record ID"); return value; }
function print_value(value) { console.log(typeof value === "string" ? value : JSON.stringify(value)); }
function remember_id(seen, value) { if (seen.has(value)) return false; seen.add(value); return true; }
function require_condition(value, message) { if (value !== true) throw new Error(message); }
function text(value) { if (value === null || value === undefined) return ""; if (["string", "boolean", "bigint"].includes(typeof value)) return String(value); throw new Error("Expected a scalar response value"); }
async function main() {
let selected_page_size = page_size(optional("EXHIBITDAY_PAGE_SIZE", "100"));
let selected_event_id = optional("EXHIBITDAY_EVENT_ID", "");
if (is_present(selected_event_id)) {
selected_event_id = positive_id(selected_event_id);
}
let tagged_user_filter = optional("EXHIBITDAY_TAGGED_USER_IDS_JSON", "");
let tag_match_type = optional("EXHIBITDAY_TAG_MATCH_TYPE", "any");
require_condition(either(equal(tag_match_type, "any"), equal(tag_match_type, "all")), "Choose any or all for EXHIBITDAY_TAG_MATCH_TYPE.");
let staff_query = {"$limit": selected_page_size};
if (is_present(selected_event_id)) {
staff_query["filter_by_event_id"] = selected_event_id;
}
let staff_offset = "0";
let staff_seen_ids = new_id_set();
print_value("Staff record ID\tEvent ID");
while (true) {
staff_query["$offset"] = staff_offset;
let staff_response = await call("staff_pages", staff_query, null, null);
let staff_page = staff_response.body;
let staff_rows = items(field(staff_page, "list_data"));
require_condition(equal(text(field(staff_page, "records_found")), text(count(staff_rows))), "records_found does not match this page's rows.");
require_condition(is_present(text(field(staff_page, "total_records"))), "The collection wrapper needs total_records.");
require_condition(either(equal(field(staff_page, "has_more"), true), equal(field(staff_page, "has_more"), false)), "Expected a Boolean has_more value.");
for (const staff_record of items(staff_rows)) {
let staff_record_id = positive_id(text(field(staff_record, "id")));
let staff_event_id = positive_id(text(field(staff_record, "event_id")));
if (is_present(selected_event_id)) {
require_condition(equal(staff_event_id, selected_event_id), "A returned row belongs to a different Event.");
}
if (remember_id(staff_seen_ids, staff_record_id)) {
print_value(concat(staff_record_id, concat("\t", staff_event_id)));
}
}
if (equal(field(staff_page, "has_more"), false)) {
break;
}
require_condition(not_value(is_empty(staff_rows)), "An empty page has has_more=true; stop and reconcile the query.");
staff_offset = add_offset(staff_offset, count(staff_rows));
}
let travel_query = {"$limit": selected_page_size};
if (is_present(selected_event_id)) {
travel_query["filter_by_event_id"] = selected_event_id;
}
if (is_present(tagged_user_filter)) {
travel_query["filter_by_tagged_user_ids"] = tagged_user_filter;
travel_query["filter_by_tagged_user_ids_match_type"] = tag_match_type;
}
let travel_offset = "0";
let travel_seen_ids = new_id_set();
print_value("Travel record ID\tEvent ID");
while (true) {
travel_query["$offset"] = travel_offset;
let travel_response = await call("travel_pages", travel_query, null, null);
let travel_page = travel_response.body;
let travel_rows = items(field(travel_page, "list_data"));
require_condition(equal(text(field(travel_page, "records_found")), text(count(travel_rows))), "records_found does not match this page's rows.");
require_condition(is_present(text(field(travel_page, "total_records"))), "The collection wrapper needs total_records.");
require_condition(either(equal(field(travel_page, "has_more"), true), equal(field(travel_page, "has_more"), false)), "Expected a Boolean has_more value.");
for (const travel_record of items(travel_rows)) {
let travel_record_id = positive_id(text(field(travel_record, "id")));
let travel_event_id = positive_id(text(field(travel_record, "event_id")));
if (is_present(selected_event_id)) {
require_condition(equal(travel_event_id, selected_event_id), "A returned row belongs to a different Event.");
}
if (remember_id(travel_seen_ids, travel_record_id)) {
print_value(concat(travel_record_id, concat("\t", travel_event_id)));
}
}
if (equal(field(travel_page, "has_more"), false)) {
break;
}
require_condition(not_value(is_empty(travel_rows)), "An empty page has has_more=true; stop and reconcile the query.");
travel_offset = add_offset(travel_offset, count(travel_rows));
}
}
if (require.main === module) main().catch(error => { console.error(error.message); process.exitCode = 1; });
module.exports = { main };
# Python 3; standard library only. Set EXHIBITDAY_API_KEY before running.
import http.client
import json
import os
import re
import time
import urllib.error
import urllib.parse
import urllib.request
BASE = "https://api.exhibitday.com/v1"
SPEC = json.loads("{\"preserveNumbers\":true,\"requests\":{\"staff_pages\":{\"method\":\"GET\",\"path\":\"/events/staff\"},\"travel_pages\":{\"method\":\"GET\",\"path\":\"/events/travel_reservations\"}}}")
API_KEY = os.environ["EXHIBITDAY_API_KEY"]
if any(ord(char) < 32 or ord(char) > 126 for char in API_KEY):
raise RuntimeError("Use the API key as one ASCII header value without control characters")
if not API_KEY.strip():
raise RuntimeError("Set EXHIBITDAY_API_KEY")
def decode_json(text):
if SPEC["preserveNumbers"]:
# Quote JSON NUMBER tokens, never text inside a JSON string, to keep CSV decimals exact.
text = re.sub(r'"(?:\\.|[^"\\])*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?',
lambda m: m[0] if m[0].startswith('"') else json.dumps(m[0]), text)
return json.loads(text)
class NoRedirect(urllib.request.HTTPRedirectHandler):
def redirect_request(self, request, file, code, message, headers, new_url):
return None
OPENER = urllib.request.build_opener(NoRedirect())
def transport(method, url, headers, data):
request = urllib.request.Request(url, data=data, headers=headers, method=method)
try:
with OPENER.open(request, timeout=30) as response:
return response.status, response.read(), dict(response.headers)
except urllib.error.HTTPError as response:
try:
return response.code, response.read(), dict(response.headers)
finally:
response.close()
class ApiError(RuntimeError):
"""An API error response. Branch on error_code (and status), never on the message text.
uncertain is True when a PATCH or DELETE got no response or a server error: it may or may not have been applied."""
def __init__(self, status, body, uncertain=False):
self.status = status
self.uncertain = uncertain
self.error_code = body.get("error_code") if isinstance(body, dict) else None
super().__init__(f"{body.get('error_code')} {body.get('error_params')}: {body.get('errors')} (request {body.get('request_id')})"
if isinstance(body, dict) else "HTTP " + str(status) if status else "No response")
def call(name, params=None, body=None, key=None):
route = SPEC["requests"][name]
headers = {"Authorization": "Bearer " + API_KEY, "Accept": "application/json"}
if route["method"] == "POST":
if not key: raise RuntimeError("Persist a logical create key before sending POST")
headers["Idempotency-Key"] = key
data = None if body is None else json.dumps(body).encode("utf-8")
if data is not None:
headers["Content-Type"] = "application/json"
query = urllib.parse.urlencode(params or {})
url = BASE + route["path"] + ("?" + query if query else "")
# Only GET has automatic retries in this workflow. A PATCH or DELETE that got no response or a
# server error is never resent blindly: it may already have been applied, so the caller reads the record first.
resend = route["method"] == "GET"
for attempt in range(5):
try:
status, raw, response_headers = transport(route["method"], url, headers, data)
except (urllib.error.URLError, TimeoutError, ConnectionError, http.client.HTTPException):
if not resend:
raise ApiError(0, None, uncertain=True)
if attempt == 4:
raise
time.sleep(2 ** attempt)
continue
response_headers = {k.lower(): v for k, v in response_headers.items()}
result = None
if status != 304 and raw:
try:
result = decode_json(raw.decode("utf-8"))
except (ValueError, UnicodeError):
if status < 400:
raise RuntimeError("Expected a JSON success response")
if status >= 500 and not resend:
raise ApiError(status, result, uncertain=True)
retry = resend and (status == 429 or status >= 500)
if retry:
if attempt == 4:
raise RuntimeError("Retry limit reached; check the request outcome before starting a new create")
delay = response_headers.get("retry-after", str(2 ** attempt))
time.sleep(max(0, float(delay)))
continue
if status >= 400:
raise ApiError(status, result)
return {"status": status, "body": result, "headers": response_headers, "raw": raw}
raise RuntimeError("Retry limit reached")
def add_offset(offset, received):
result = int(offset) + received
if received <= 0 or result > 2147483647: raise RuntimeError("Cannot advance this int32 offset; reconcile the query")
return str(result)
def concat(left, right):
return left + right
def items(value):
if not isinstance(value, list): raise RuntimeError("Expected a JSON array")
return value
def count(value):
return len(items(value))
def either(left, right):
if not isinstance(left, bool) or not isinstance(right, bool): raise RuntimeError("Expected Boolean criteria")
return left or right
def equal(left, right):
return type(left) is type(right) and left == right
def field(value, name):
if not isinstance(value, dict) or name not in value: raise RuntimeError("Missing response field: " + name)
return value[name]
def is_empty(value):
return count(value) == 0
def is_present(value):
return value is not None and value != ""
def new_id_set():
return set()
def not_value(value):
if not isinstance(value, bool): raise RuntimeError("Expected a Boolean")
return not value
def optional(name, fallback):
value = os.environ.get(name)
return fallback if value is None or value == "" else value
def page_size(value):
if not re.fullmatch(r"[1-9][0-9]*", value) or int(value) > 2147483647: raise RuntimeError("Page size must be a positive int32")
return value
def positive_id(value):
if not re.fullmatch(r"[1-9][0-9]*", value) or int(value) > 9223372036854775807: raise RuntimeError("Use a positive record ID")
return value
def print_value(value):
print(value if isinstance(value, str) else json.dumps(value, ensure_ascii=False))
def remember_id(seen, value):
if value in seen: return False
seen.add(value)
return True
def require_condition(value, message):
if value is not True: raise RuntimeError(message)
def text(value):
if value is None: return ""
if isinstance(value, str): return value
if isinstance(value, bool): return "true" if value else "false"
if isinstance(value, int): return str(value)
raise RuntimeError("Expected a scalar response value")
def main():
selected_page_size = page_size(optional("EXHIBITDAY_PAGE_SIZE", "100"))
selected_event_id = optional("EXHIBITDAY_EVENT_ID", "")
if is_present(selected_event_id):
selected_event_id = positive_id(selected_event_id)
tagged_user_filter = optional("EXHIBITDAY_TAGGED_USER_IDS_JSON", "")
tag_match_type = optional("EXHIBITDAY_TAG_MATCH_TYPE", "any")
require_condition(either(equal(tag_match_type, "any"), equal(tag_match_type, "all")), "Choose any or all for EXHIBITDAY_TAG_MATCH_TYPE.")
staff_query = {"$limit": selected_page_size}
if is_present(selected_event_id):
staff_query["filter_by_event_id"] = selected_event_id
staff_offset = "0"
staff_seen_ids = new_id_set()
print_value("Staff record ID\tEvent ID")
while True:
staff_query["$offset"] = staff_offset
staff_response = call("staff_pages", staff_query, None, None)
staff_page = staff_response["body"]
staff_rows = items(field(staff_page, "list_data"))
require_condition(equal(text(field(staff_page, "records_found")), text(count(staff_rows))), "records_found does not match this page's rows.")
require_condition(is_present(text(field(staff_page, "total_records"))), "The collection wrapper needs total_records.")
require_condition(either(equal(field(staff_page, "has_more"), True), equal(field(staff_page, "has_more"), False)), "Expected a Boolean has_more value.")
for staff_record in items(staff_rows):
staff_record_id = positive_id(text(field(staff_record, "id")))
staff_event_id = positive_id(text(field(staff_record, "event_id")))
if is_present(selected_event_id):
require_condition(equal(staff_event_id, selected_event_id), "A returned row belongs to a different Event.")
if remember_id(staff_seen_ids, staff_record_id):
print_value(concat(staff_record_id, concat("\t", staff_event_id)))
if equal(field(staff_page, "has_more"), False):
break
require_condition(not_value(is_empty(staff_rows)), "An empty page has has_more=true; stop and reconcile the query.")
staff_offset = add_offset(staff_offset, count(staff_rows))
travel_query = {"$limit": selected_page_size}
if is_present(selected_event_id):
travel_query["filter_by_event_id"] = selected_event_id
if is_present(tagged_user_filter):
travel_query["filter_by_tagged_user_ids"] = tagged_user_filter
travel_query["filter_by_tagged_user_ids_match_type"] = tag_match_type
travel_offset = "0"
travel_seen_ids = new_id_set()
print_value("Travel record ID\tEvent ID")
while True:
travel_query["$offset"] = travel_offset
travel_response = call("travel_pages", travel_query, None, None)
travel_page = travel_response["body"]
travel_rows = items(field(travel_page, "list_data"))
require_condition(equal(text(field(travel_page, "records_found")), text(count(travel_rows))), "records_found does not match this page's rows.")
require_condition(is_present(text(field(travel_page, "total_records"))), "The collection wrapper needs total_records.")
require_condition(either(equal(field(travel_page, "has_more"), True), equal(field(travel_page, "has_more"), False)), "Expected a Boolean has_more value.")
for travel_record in items(travel_rows):
travel_record_id = positive_id(text(field(travel_record, "id")))
travel_event_id = positive_id(text(field(travel_record, "event_id")))
if is_present(selected_event_id):
require_condition(equal(travel_event_id, selected_event_id), "A returned row belongs to a different Event.")
if remember_id(travel_seen_ids, travel_record_id):
print_value(concat(travel_record_id, concat("\t", travel_event_id)))
if equal(field(travel_page, "has_more"), False):
break
require_condition(not_value(is_empty(travel_rows)), "An empty page has has_more=true; stop and reconcile the query.")
travel_offset = add_offset(travel_offset, count(travel_rows))
if __name__ == "__main__":
main()
// .NET 8 console program; standard library only. Set EXHIBITDAY_API_KEY.
#nullable disable
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Threading.Tasks;
class Program
{
static readonly string BaseUrl = "https://api.exhibitday.com/v1";
static readonly JsonNode Spec = JsonNode.Parse("{\"preserveNumbers\":true,\"requests\":{\"staff_pages\":{\"method\":\"GET\",\"path\":\"/events/staff\"},\"travel_pages\":{\"method\":\"GET\",\"path\":\"/events/travel_reservations\"}}}");
static readonly string ApiKey = HeaderKey(Required("EXHIBITDAY_API_KEY"));
static string HeaderKey(string value) { if(value.Any(c=>c<32||c>126))throw new Exception("Use the API key as one ASCII header value without control characters");return value; }
static readonly HttpClient Client = new HttpClient(new HttpClientHandler { AllowAutoRedirect = false }) { Timeout = TimeSpan.FromSeconds(30) };
internal static Func<HttpRequestMessage, Task<HttpResponseMessage>> Send = request => Client.SendAsync(request);
sealed class Result { public int Status; public JsonNode Body; public Dictionary<string, string> Headers; public string Raw; }
// An API error response. Branch on ErrorCode (and Status), never on the message text.
// Uncertain is true when a PATCH or DELETE got no response or a server error: it may or may not have been applied.
sealed class ApiException : Exception
{
public int Status { get; }
public string ErrorCode { get; }
public bool Uncertain { get; }
public ApiException(int status, string errorCode, string message, bool uncertain = false) : base(message) { Status = status; ErrorCode = errorCode; Uncertain = uncertain; }
}
static string Required(string name)
{ var value = Environment.GetEnvironmentVariable(name); return string.IsNullOrWhiteSpace(value) ? throw new Exception("Set " + name) : value; }
static string Text(JsonNode value) => value == null ? "" :
value is JsonValue scalar && scalar.TryGetValue<string>(out var text) ? text : value.ToJsonString();
static JsonObject Query(params (string Key, string Value)[] values)
{ var result = new JsonObject(); foreach (var value in values) result[value.Key] = value.Value; return result; }
static async Task<Result> Call(string name, JsonObject query = null, JsonNode body = null,
string key = null)
{
var route = Spec["requests"][name];
var method = Text(route["method"]);
var headers = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{ ["Authorization"] = "Bearer " + ApiKey, ["Accept"] = "application/json" };
if (method == "POST") { if (string.IsNullOrEmpty(key)) throw new Exception("Persist a logical create key before sending POST"); headers["Idempotency-Key"] = key; }
var data = body?.ToJsonString();
var suffix = query == null ? "" : string.Join("&", query.Select(p => Uri.EscapeDataString(p.Key) + "=" + Uri.EscapeDataString(Text(p.Value))));
var url = BaseUrl + Text(route["path"]) + (suffix.Length == 0 ? "" : "?" + suffix);
// Only GET has automatic retries in this workflow. A PATCH or DELETE that got no response or a
// server error is never resent blindly: it may already have been applied, so the caller reads the record first.
var resend = method == "GET";
for (var attempt = 0; attempt < 5; attempt++)
{
using var request = new HttpRequestMessage(new HttpMethod(method), url);
foreach (var header in headers) request.Headers.TryAddWithoutValidation(header.Key, header.Value);
if (data != null) request.Content = new StringContent(data, Encoding.UTF8, "application/json");
HttpResponseMessage response;
string raw;
try { response = await Send(request); }
catch (Exception error) when (error is HttpRequestException || error is TaskCanceledException)
{ if (!resend) throw new ApiException(0, null, "No response", true); if (attempt == 4) throw; await Task.Delay(TimeSpan.FromSeconds(Math.Pow(2, attempt))); continue; }
using (response)
{
try { raw = await response.Content.ReadAsStringAsync(); }
catch (Exception error) when (error is HttpRequestException || error is TaskCanceledException)
{ if (!resend) throw new ApiException(0, null, "No response", true); if (attempt == 4) throw; await Task.Delay(TimeSpan.FromSeconds(Math.Pow(2, attempt))); continue; }
var status = (int)response.StatusCode;
var resultHeaders = response.Headers.Concat(response.Content.Headers)
.ToDictionary(h => h.Key.ToLowerInvariant(), h => string.Join(", ", h.Value));
JsonNode result = null;
if (status != 304 && raw.Length > 0)
{
try { result = JsonNode.Parse(raw); }
catch (JsonException) { if (status < 400) throw new Exception("Expected a JSON success response"); }
}
var errorBody = result as JsonObject;
if (status >= 500 && !resend) throw new ApiException(status, errorBody == null ? null : Text(errorBody["error_code"]), "HTTP " + status, true);
var retry = resend && (status == 429 || status >= 500);
if (retry)
{
if (attempt == 4) throw new Exception("Retry limit reached; check the outcome before starting a new create");
var seconds = Math.Pow(2, attempt);
if (resultHeaders.TryGetValue("retry-after", out var requested) &&
double.TryParse(requested, NumberStyles.Float, CultureInfo.InvariantCulture, out var delay) &&
double.IsFinite(delay) && delay >= 0) seconds = delay;
await Task.Delay(TimeSpan.FromSeconds(seconds)); continue;
}
if (status >= 400) throw new ApiException(status, errorBody == null ? null : Text(errorBody["error_code"]), errorBody == null ? "HTTP " + status :
$"{Text(errorBody["error_code"])} {errorBody["error_params"]}: {errorBody["errors"]} (request {Text(errorBody["request_id"])})");
return new Result { Status = status, Body = result, Headers = resultHeaders, Raw = raw };
}
}
throw new Exception("Retry limit reached");
}
static string AddOffset(string offset,long received) { var result=checked(long.Parse(offset,CultureInfo.InvariantCulture)+received);if(received<=0||result>int.MaxValue)throw new Exception("Cannot advance this int32 offset; reconcile the query");return result.ToString(CultureInfo.InvariantCulture); }
static string Concat(string left,string right) => left+right;
static JsonArray Items(JsonNode value) => value as JsonArray ?? throw new Exception("Expected a JSON array");
static long Count(JsonNode value) => Items(value).Count;
static bool Either(bool left,bool right) => left || right;
static object Scalar(object value) { if(value is JsonValue json){if(json.TryGetValue<bool>(out var boolean))return boolean;if(json.TryGetValue<string>(out var text))return text;return json.ToJsonString();}return value; }
static bool Equal(object left,object right) => object.Equals(Scalar(left),Scalar(right));
static JsonNode Field(JsonNode value,string name) { if(value is not JsonObject obj || !obj.TryGetPropertyValue(name,out var item))throw new Exception("Missing response field: "+name);return item; }
static bool IsEmpty(JsonNode value) => Count(value)==0;
static bool IsPresent(string value) => value!=null && value!="";
static HashSet<string> NewIdSet() => new HashSet<string>(StringComparer.Ordinal);
static bool NotValue(bool value) => !value;
static string Optional(string name,string fallback) { var value=Environment.GetEnvironmentVariable(name);return value==null||value==""?fallback:value; }
static string PageSize(string value) { if(string.IsNullOrEmpty(value)||value[0]=='0'||!value.All(c=>c>='0'&&c<='9')||!int.TryParse(value,NumberStyles.None,CultureInfo.InvariantCulture,out var limit)||limit<=0)throw new Exception("Page size must be a positive int32");return value; }
static string PositiveId(string value) { if(string.IsNullOrEmpty(value)||value[0]=='0'||!value.All(c=>c>='0'&&c<='9')||!long.TryParse(value,NumberStyles.None,CultureInfo.InvariantCulture,out var id)||id<=0)throw new Exception("Use a positive record ID");return value; }
static void PrintValue(object value) => Console.WriteLine(value is string text ? text : JsonSerializer.Serialize(value));
static bool RememberId(HashSet<string> seen,string value) => seen.Add(value);
static void RequireCondition(bool value,string message) { if(!value)throw new Exception(message); }
static string Text(object value) => value==null?"":value is JsonNode node?Text(node):Convert.ToString(value,CultureInfo.InvariantCulture);
internal static async Task Run()
{
var selected_page_size = PageSize(Optional("EXHIBITDAY_PAGE_SIZE", "100"));
var selected_event_id = Optional("EXHIBITDAY_EVENT_ID", "");
if (IsPresent(selected_event_id)) {
selected_event_id = PositiveId(selected_event_id);
}
var tagged_user_filter = Optional("EXHIBITDAY_TAGGED_USER_IDS_JSON", "");
var tag_match_type = Optional("EXHIBITDAY_TAG_MATCH_TYPE", "any");
RequireCondition(Either(Equal(tag_match_type, "any"), Equal(tag_match_type, "all")), "Choose any or all for EXHIBITDAY_TAG_MATCH_TYPE.");
var staff_query = new JsonObject { ["$limit"] = selected_page_size };
if (IsPresent(selected_event_id)) {
staff_query["filter_by_event_id"] = selected_event_id;
}
var staff_offset = "0";
var staff_seen_ids = NewIdSet();
PrintValue("Staff record ID\tEvent ID");
while (true) {
staff_query["$offset"] = staff_offset;
var staff_response = await Call("staff_pages", staff_query, null, null);
var staff_page = staff_response.Body;
var staff_rows = Items(Field(staff_page, "list_data"));
RequireCondition(Equal(Text(Field(staff_page, "records_found")), Text(Count(staff_rows))), "records_found does not match this page's rows.");
RequireCondition(IsPresent(Text(Field(staff_page, "total_records"))), "The collection wrapper needs total_records.");
RequireCondition(Either(Equal(Field(staff_page, "has_more"), true), Equal(Field(staff_page, "has_more"), false)), "Expected a Boolean has_more value.");
foreach (var staff_record in Items(staff_rows)) {
var staff_record_id = PositiveId(Text(Field(staff_record, "id")));
var staff_event_id = PositiveId(Text(Field(staff_record, "event_id")));
if (IsPresent(selected_event_id)) {
RequireCondition(Equal(staff_event_id, selected_event_id), "A returned row belongs to a different Event.");
}
if (RememberId(staff_seen_ids, staff_record_id)) {
PrintValue(Concat(staff_record_id, Concat("\t", staff_event_id)));
}
}
if (Equal(Field(staff_page, "has_more"), false)) {
break;
}
RequireCondition(NotValue(IsEmpty(staff_rows)), "An empty page has has_more=true; stop and reconcile the query.");
staff_offset = AddOffset(staff_offset, Count(staff_rows));
}
var travel_query = new JsonObject { ["$limit"] = selected_page_size };
if (IsPresent(selected_event_id)) {
travel_query["filter_by_event_id"] = selected_event_id;
}
if (IsPresent(tagged_user_filter)) {
travel_query["filter_by_tagged_user_ids"] = tagged_user_filter;
travel_query["filter_by_tagged_user_ids_match_type"] = tag_match_type;
}
var travel_offset = "0";
var travel_seen_ids = NewIdSet();
PrintValue("Travel record ID\tEvent ID");
while (true) {
travel_query["$offset"] = travel_offset;
var travel_response = await Call("travel_pages", travel_query, null, null);
var travel_page = travel_response.Body;
var travel_rows = Items(Field(travel_page, "list_data"));
RequireCondition(Equal(Text(Field(travel_page, "records_found")), Text(Count(travel_rows))), "records_found does not match this page's rows.");
RequireCondition(IsPresent(Text(Field(travel_page, "total_records"))), "The collection wrapper needs total_records.");
RequireCondition(Either(Equal(Field(travel_page, "has_more"), true), Equal(Field(travel_page, "has_more"), false)), "Expected a Boolean has_more value.");
foreach (var travel_record in Items(travel_rows)) {
var travel_record_id = PositiveId(Text(Field(travel_record, "id")));
var travel_event_id = PositiveId(Text(Field(travel_record, "event_id")));
if (IsPresent(selected_event_id)) {
RequireCondition(Equal(travel_event_id, selected_event_id), "A returned row belongs to a different Event.");
}
if (RememberId(travel_seen_ids, travel_record_id)) {
PrintValue(Concat(travel_record_id, Concat("\t", travel_event_id)));
}
}
if (Equal(Field(travel_page, "has_more"), false)) {
break;
}
RequireCondition(NotValue(IsEmpty(travel_rows)), "An empty page has has_more=true; stop and reconcile the query.");
travel_offset = AddOffset(travel_offset, Count(travel_rows));
}
}
static Task Main() => Run();
}
// Java 11+ with Gson on the classpath. Set EXHIBITDAY_API_KEY; save as Main.java.
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.ToNumberPolicy;
import java.io.*;
import java.net.*;
import java.net.http.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.*;
import java.time.*;
import java.util.*;
public class Main {
static final Gson JSON = new GsonBuilder().setObjectToNumberStrategy(ToNumberPolicy.LAZILY_PARSED_NUMBER).create();
static final String BASE = "https://api.exhibitday.com/v1";
static final Map<String,Object> SPEC = JSON.fromJson("{\"preserveNumbers\":true,\"requests\":{\"staff_pages\":{\"method\":\"GET\",\"path\":\"/events/staff\"},\"travel_pages\":{\"method\":\"GET\",\"path\":\"/events/travel_reservations\"}}}", Map.class);
static final String API_KEY = headerKey(required("EXHIBITDAY_API_KEY"));
static String headerKey(String value){if(value.chars().anyMatch(c->c<32||c>126))throw new IllegalArgumentException("Use the API key as one ASCII header value without control characters");return value;}
static final HttpClient CLIENT = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(30)).followRedirects(HttpClient.Redirect.NEVER).build();
interface RequestSender { HttpResponse<String> send(HttpRequest request)throws IOException,InterruptedException; }
static RequestSender SEND=request->CLIENT.send(request,HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8));
static class Result { int status; Object body; Map<String,String> headers; String raw;
Result(int s, Object b, Map<String,String> h,String r) {status=s;body=b;headers=h;raw=r;} }
// An API error response. Branch on errorCode (and status), never on the message text.
// uncertain is true when a PATCH or DELETE got no response or a server error: it may or may not have been applied.
static class ApiException extends IllegalStateException { final int status; final String errorCode; final boolean uncertain;
ApiException(int status,Object errorCode,String message) {this(status,errorCode,message,false);}
ApiException(int status,Object errorCode,String message,boolean uncertain) {super(message);this.status=status;this.errorCode=errorCode==null?null:String.valueOf(errorCode);this.uncertain=uncertain;} }
static String required(String name) {String value=System.getenv(name);if(value==null||value.trim().isEmpty())throw new IllegalArgumentException("Set "+name);return value;}
static String env(String name,String fallback) {String value=System.getenv(name);return value==null||value.isEmpty()?fallback:value;}
static String text(Object value) {return value==null?"":value.toString();}
@SuppressWarnings("unchecked") static Map<String,Object> obj(Object value) {return value==null?new LinkedHashMap<>(): (Map<String,Object>)value;}
@SuppressWarnings("unchecked") static List<Object> list(Object value) {return value==null?Collections.emptyList():(List<Object>)value;}
static Map<String,Object> map(Object... pairs) {Map<String,Object> result=new LinkedHashMap<>();for(int i=0;i<pairs.length;i+=2)result.put((String)pairs[i],pairs[i+1]);return result;}
static void pause(double seconds) {try {Thread.sleep((long)(Math.max(0,seconds)*1000));}catch(InterruptedException error){Thread.currentThread().interrupt();throw new RuntimeException(error);}}
static Result call(String name,Map<String,Object> query,Object body,String key) {
Map<String,Object> route=obj(obj(SPEC.get("requests")).get(name));String method=text(route.get("method"));
Map<String,Object> headers=map("Authorization","Bearer " + API_KEY,"Accept","application/json");
if(method.equals("POST")){if(key==null||key.isEmpty())throw new IllegalArgumentException("Persist a logical create key before sending POST");headers.put("Idempotency-Key",key);}
String data=body==null?null:JSON.toJson(body);if(data!=null)headers.put("Content-Type","application/json");
StringJoiner queryString=new StringJoiner("&");
if(query!=null)query.forEach((k,v)->queryString.add(URLEncoder.encode(k,StandardCharsets.UTF_8)+"="+URLEncoder.encode(text(v),StandardCharsets.UTF_8)));
String url=BASE+text(route.get("path"))+(queryString.length()==0?"":"?"+queryString);
// Only GET has automatic retries in this workflow. A PATCH or DELETE that got no response or a
// server error is never resent blindly: it may already have been applied, so the caller reads the record first.
boolean resend=method.equals("GET");
for(int attempt=0;attempt<5;attempt++) {
HttpRequest.Builder request=HttpRequest.newBuilder(URI.create(url)).timeout(Duration.ofSeconds(30));
headers.forEach((k,v)->request.header(k,text(v)));
request.method(method,data==null?HttpRequest.BodyPublishers.noBody():HttpRequest.BodyPublishers.ofString(data,StandardCharsets.UTF_8));
HttpResponse<String> response;
try {response=SEND.send(request.build());}
catch(InterruptedException error){Thread.currentThread().interrupt();throw new RuntimeException(error);}
catch(IOException error){if(!resend)throw new ApiException(0,null,"No response",true);if(attempt==4)throw new RuntimeException(error);pause(Math.pow(2,attempt));continue;}
int status=response.statusCode();Object parsed=null;
if(status!=304&&!response.body().isEmpty()) {
try {parsed=JSON.fromJson(response.body(),Object.class);}
catch(RuntimeException error){if(status<400)throw new IllegalStateException("Expected a JSON success response",error);}
}
Map<String,String> responseHeaders=new HashMap<>();response.headers().map().forEach((k,v)->responseHeaders.put(k.toLowerCase(Locale.ROOT),String.join(", ",v)));
if(status>=500&&!resend)throw new ApiException(status,obj(parsed).get("error_code"),"HTTP "+status,true);
boolean retry=resend&&(status==429||status>=500);
if(retry) {
if(attempt==4)throw new IllegalStateException("Retry limit reached; check the outcome before starting a new create");
double seconds=Math.pow(2,attempt);
try {double value=Double.parseDouble(responseHeaders.get("retry-after"));if(Double.isFinite(value)&&value>=0)seconds=value;}catch(Exception ignored){}
pause(seconds);continue;
}
if(status>=400)throw new ApiException(status,obj(parsed).get("error_code"),"HTTP "+status+": "+obj(parsed).get("error_code")+" (request "+obj(parsed).get("request_id")+")");
return new Result(status,parsed,responseHeaders,response.body());
}
throw new IllegalStateException("Retry limit reached");
}
static String add_offset(String offset,long received){long result=Math.addExact(Long.parseLong(offset),received);if(received<=0||result>Integer.MAX_VALUE)throw new IllegalStateException("Cannot advance this int32 offset; reconcile the query");return Long.toString(result);}
static String concat(String left,String right){return left+right;}
static List<Object> items(Object value){if(!(value instanceof List))throw new IllegalStateException("Expected a JSON array");return list(value);}
static long count(Object value){return items(value).size();}
static boolean either(boolean left,boolean right){return left||right;}
static boolean equal(Object left,Object right){return Objects.equals(left,right);}
static Object field(Object value,String name){if(!(value instanceof Map)||!obj(value).containsKey(name))throw new IllegalStateException("Missing response field: "+name);return obj(value).get(name);}
static boolean is_empty(Object value){return count(value)==0;}
static boolean is_present(String value){return value!=null&&!value.isEmpty();}
static Set<String> new_id_set(){return new HashSet<>();}
static boolean not_value(boolean value){return !value;}
static String optional(String name,String fallback){String value=System.getenv(name);return value==null||value.isEmpty()?fallback:value;}
static String page_size(String value){try{if(value==null||!value.matches("[1-9][0-9]*")||Integer.parseInt(value)<=0)throw new IllegalArgumentException();return value;}catch(RuntimeException error){throw new IllegalArgumentException("Page size must be a positive int32");}}
static String positive_id(String value){try{if(value==null||!value.matches("[1-9][0-9]*")||Long.parseLong(value)<=0)throw new IllegalArgumentException();return value;}catch(RuntimeException error){throw new IllegalArgumentException("Use a positive record ID");}}
static void print_value(Object value){try{String text=value instanceof String?(String)value:JSON.toJson(value);System.out.write((text+"\n").getBytes(StandardCharsets.UTF_8));}catch(IOException error){throw new UncheckedIOException(error);}}
static boolean remember_id(Set<String> seen,String value){return seen.add(value);}
static void require_condition(boolean value,String message){if(!value)throw new IllegalStateException(message);}
static void run()throws Exception {
String selected_page_size = page_size(optional("EXHIBITDAY_PAGE_SIZE", "100"));
String selected_event_id = optional("EXHIBITDAY_EVENT_ID", "");
if (is_present(selected_event_id)) {
selected_event_id = positive_id(selected_event_id);
}
String tagged_user_filter = optional("EXHIBITDAY_TAGGED_USER_IDS_JSON", "");
String tag_match_type = optional("EXHIBITDAY_TAG_MATCH_TYPE", "any");
require_condition(either(equal(tag_match_type, "any"), equal(tag_match_type, "all")), "Choose any or all for EXHIBITDAY_TAG_MATCH_TYPE.");
Map<String,Object> staff_query = map("$limit", selected_page_size);
if (is_present(selected_event_id)) {
staff_query.put("filter_by_event_id", selected_event_id);
}
String staff_offset = "0";
Set<String> staff_seen_ids = new_id_set();
print_value("Staff record ID\tEvent ID");
while (true) {
staff_query.put("$offset", staff_offset);
Result staff_response = call("staff_pages", staff_query, null, null);
Object staff_page = staff_response.body;
List<Object> staff_rows = items(field(staff_page, "list_data"));
require_condition(equal(text(field(staff_page, "records_found")), text(count(staff_rows))), "records_found does not match this page's rows.");
require_condition(is_present(text(field(staff_page, "total_records"))), "The collection wrapper needs total_records.");
require_condition(either(equal(field(staff_page, "has_more"), true), equal(field(staff_page, "has_more"), false)), "Expected a Boolean has_more value.");
for (Object staff_record : items(staff_rows)) {
String staff_record_id = positive_id(text(field(staff_record, "id")));
String staff_event_id = positive_id(text(field(staff_record, "event_id")));
if (is_present(selected_event_id)) {
require_condition(equal(staff_event_id, selected_event_id), "A returned row belongs to a different Event.");
}
if (remember_id(staff_seen_ids, staff_record_id)) {
print_value(concat(staff_record_id, concat("\t", staff_event_id)));
}
}
if (equal(field(staff_page, "has_more"), false)) {
break;
}
require_condition(not_value(is_empty(staff_rows)), "An empty page has has_more=true; stop and reconcile the query.");
staff_offset = add_offset(staff_offset, count(staff_rows));
}
Map<String,Object> travel_query = map("$limit", selected_page_size);
if (is_present(selected_event_id)) {
travel_query.put("filter_by_event_id", selected_event_id);
}
if (is_present(tagged_user_filter)) {
travel_query.put("filter_by_tagged_user_ids", tagged_user_filter);
travel_query.put("filter_by_tagged_user_ids_match_type", tag_match_type);
}
String travel_offset = "0";
Set<String> travel_seen_ids = new_id_set();
print_value("Travel record ID\tEvent ID");
while (true) {
travel_query.put("$offset", travel_offset);
Result travel_response = call("travel_pages", travel_query, null, null);
Object travel_page = travel_response.body;
List<Object> travel_rows = items(field(travel_page, "list_data"));
require_condition(equal(text(field(travel_page, "records_found")), text(count(travel_rows))), "records_found does not match this page's rows.");
require_condition(is_present(text(field(travel_page, "total_records"))), "The collection wrapper needs total_records.");
require_condition(either(equal(field(travel_page, "has_more"), true), equal(field(travel_page, "has_more"), false)), "Expected a Boolean has_more value.");
for (Object travel_record : items(travel_rows)) {
String travel_record_id = positive_id(text(field(travel_record, "id")));
String travel_event_id = positive_id(text(field(travel_record, "event_id")));
if (is_present(selected_event_id)) {
require_condition(equal(travel_event_id, selected_event_id), "A returned row belongs to a different Event.");
}
if (remember_id(travel_seen_ids, travel_record_id)) {
print_value(concat(travel_record_id, concat("\t", travel_event_id)));
}
}
if (equal(field(travel_page, "has_more"), false)) {
break;
}
require_condition(not_value(is_empty(travel_rows)), "An empty page has has_more=true; stop and reconcile the query.");
travel_offset = add_offset(travel_offset, count(travel_rows));
}
}
public static void main(String[] args)throws Exception {run();}
}
<?php
// PHP 8.1+ with the cURL extension. Set EXHIBITDAY_API_KEY before running.
declare(strict_types=1);
const BASE = 'https://api.exhibitday.com/v1';
const SPEC = '{"preserveNumbers":true,"requests":{"staff_pages":{"method":"GET","path":"/events/staff"},"travel_pages":{"method":"GET","path":"/events/travel_reservations"}}}';
$spec = json_decode(SPEC, true, 512, JSON_THROW_ON_ERROR);
$apiKey = required('EXHIBITDAY_API_KEY');
if(preg_match('/[^\x20-\x7e]/',$apiKey))throw new RuntimeException('Use the API key as one ASCII header value without control characters');
if (trim($apiKey) === '') throw new RuntimeException('Set EXHIBITDAY_API_KEY');
function required(string $name, bool $allowEmpty = false): string {
$value = getenv($name);
if ($value === false || (!$allowEmpty && $value === '')) {
throw new RuntimeException('Set ' . $name);
}
return $value;
}
function optional(string $name, string $fallback): string {
$value = getenv($name);
return $value === false ? $fallback : $value;
}
function decodeJson(string $text): mixed {
global $spec;
if ($spec['preserveNumbers']) {
// Quote NUMBER tokens without changing digits inside JSON strings; CSV decimals stay exact.
$pattern = <<<'JSON_NUMBER'
~"(?:\\.|[^"\\])*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?~
JSON_NUMBER;
$text = preg_replace_callback($pattern, static function (array $match): string {
return str_starts_with($match[0], '"') ? $match[0] : json_encode($match[0], JSON_THROW_ON_ERROR);
}, $text);
if ($text === null) throw new RuntimeException('Unable to preserve decimal tokens');
}
return json_decode($text, true, 512, JSON_THROW_ON_ERROR);
}
function nativeTransport(string $method, string $url, array $headers, ?string $data): array {
$responseHeaders = [];
$handle = curl_init($url);
if ($handle === false) throw new RuntimeException('Unable to initialize cURL');
$headerLines = [];
foreach ($headers as $name => $value) $headerLines[] = $name . ': ' . $value;
$options = [CURLOPT_CUSTOMREQUEST => $method, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => false,
CURLOPT_CONNECTTIMEOUT => 30, CURLOPT_TIMEOUT => 30, CURLOPT_HTTPHEADER => $headerLines,
CURLOPT_HEADERFUNCTION => static function ($handle, string $line) use (&$responseHeaders): int {
if (str_starts_with($line, 'HTTP/')) $responseHeaders = [];
$separator = strpos($line, ':');
if ($separator !== false) {
$responseHeaders[strtolower(trim(substr($line, 0, $separator)))] = trim(substr($line, $separator + 1));
}
return strlen($line);
}];
if ($data !== null) $options[CURLOPT_POSTFIELDS] = $data;
try {
curl_setopt_array($handle, $options);
$raw = curl_exec($handle);
if ($raw === false) throw new RuntimeException('Network request failed: ' . curl_error($handle));
return [(int)curl_getinfo($handle, CURLINFO_RESPONSE_CODE), $raw, $responseHeaders];
} finally {
curl_close($handle);
}
}
function retryDelay(array $headers, int $attempt): float {
$value = $headers['retry-after'] ?? '';
if (is_numeric($value)) return max(0.0, (float)$value);
$date = $value === '' ? false : strtotime($value);
return $date === false ? (float)(2 ** $attempt) : max(0.0, (float)($date - time()));
}
// An API error response. Branch on errorCode (and status), never on the message text.
// $uncertain is true when a PATCH or DELETE got no response or a server error: it may or may not have been applied.
final class ApiException extends RuntimeException {
public function __construct(public readonly int $status, public readonly ?string $errorCode, string $message, public readonly bool $uncertain = false) {
parent::__construct($message);
}
}
function call(string $name, array $params = [], mixed $body = null, ?string $key = null): array {
global $spec, $apiKey, $transport;
$route = $spec['requests'][$name];
$headers = ['Authorization' => 'Bearer ' . $apiKey, 'Accept' => 'application/json'];
if ($route['method'] === 'POST') {
if ($key === null || $key === '') throw new RuntimeException('Persist a logical create key before sending POST');
$headers['Idempotency-Key'] = $key; // ONCE, before retries.
}
$data = $body === null ? null : json_encode($body, JSON_THROW_ON_ERROR);
if ($data !== null) $headers['Content-Type'] = 'application/json';
$query = http_build_query($params, '', '&', PHP_QUERY_RFC3986);
$url = BASE . $route['path'] . ($query === '' ? '' : '?' . $query);
// Only GET has automatic retries in this workflow. A PATCH or DELETE that got no response or a
// server error is never resent blindly: it may already have been applied, so the caller reads the record first.
$resend = $route['method'] === 'GET';
for ($attempt = 0; $attempt < 5; $attempt++) {
try {
[$status, $raw, $responseHeaders] = $transport($route['method'], $url, $headers, $data);
} catch (RuntimeException $error) {
if (!$resend) throw new ApiException(0, null, 'No response', true);
if ($attempt === 4) throw $error;
usleep((int)((2 ** $attempt) * 1000000));
continue;
}
$responseHeaders = array_change_key_case($responseHeaders, CASE_LOWER);
$result = null;
if ($status !== 304 && $raw !== '') {
try { $result = decodeJson($raw); }
catch (JsonException $error) {
if ($status < 400) throw new RuntimeException('Expected a JSON success response', 0, $error);
}
}
if ($status >= 500 && !$resend) {
throw new ApiException($status, is_array($result) && isset($result['error_code']) ? (string)$result['error_code'] : null, 'HTTP ' . $status, true);
}
$retry = $resend && ($status === 429 || $status >= 500);
if ($retry) {
if ($attempt === 4) throw new RuntimeException('Retry limit reached; check the outcome before starting a new create');
usleep((int)(retryDelay($responseHeaders, $attempt) * 1000000));
continue;
}
if ($status >= 400) {
if (!is_array($result)) throw new ApiException($status, null, 'HTTP ' . $status);
throw new ApiException($status, isset($result['error_code']) ? (string)$result['error_code'] : null, json_encode(['error_code' => $result['error_code'] ?? null,
'error_params' => $result['error_params'] ?? null, 'errors' => $result['errors'] ?? null,
'request_id' => $result['request_id'] ?? null], JSON_THROW_ON_ERROR));
}
return ['status' => $status, 'body' => $result, 'headers' => $responseHeaders, 'raw' => $raw];
}
throw new RuntimeException('Retry limit reached');
}
$transport = Closure::fromCallable('nativeTransport');
function add_offset(string $offset,int $received):string{$result=(int)$offset+$received;if($received<=0||$result>2147483647)throw new RuntimeException("Cannot advance this int32 offset; reconcile the query");return (string)$result;}
function concat(string $left,string $right):string{return $left.$right;}
function either(bool $left,bool $right):bool{return $left||$right;}
function equal(mixed $left,mixed $right):bool{return $left===$right;}
function field(mixed $value,string $name):mixed{if(!is_array($value)||!array_key_exists($name,$value))throw new RuntimeException("Missing response field: ".$name);return $value[$name];}
function items(mixed $value):array{if(!is_array($value)||!array_is_list($value))throw new RuntimeException("Expected a JSON array");return $value;}
function is_empty(mixed $value):bool{return count(items($value))===0;}
function is_present(?string $value):bool{return $value!==null&&$value!=="";}
function new_id_set():array{return [];}
function not_value(bool $value):bool{return !$value;}
function page_size(string $value):string{if(!preg_match("/^[1-9][0-9]*$/D",$value)||strlen($value)>10||(strlen($value)===10&&strcmp($value,"2147483647")>0))throw new RuntimeException("Page size must be a positive int32");return $value;}
function positive_id(string $value):string{if(!preg_match("/^[1-9][0-9]*$/D",$value)||strlen($value)>19||(strlen($value)===19&&strcmp($value,"9223372036854775807")>0))throw new RuntimeException("Use a positive record ID");return $value;}
function print_value(mixed $value):void{echo (is_string($value)?$value:json_encode($value,JSON_THROW_ON_ERROR))."\n";}
function remember_id(array &$seen,string $value):bool{if(array_key_exists($value,$seen))return false;$seen[$value]=true;return true;}
function require_condition(bool $value,string $message):void{if(!$value)throw new RuntimeException($message);}
function text(mixed $value):string{if($value===null)return "";if(is_string($value))return $value;if(is_bool($value))return $value?"true":"false";if(is_int($value))return (string)$value;throw new RuntimeException("Expected a scalar response value");}
function main():void {
$selected_page_size = page_size(optional('EXHIBITDAY_PAGE_SIZE', '100'));
$selected_event_id = optional('EXHIBITDAY_EVENT_ID', '');
if (is_present($selected_event_id)) {
$selected_event_id = positive_id($selected_event_id);
}
$tagged_user_filter = optional('EXHIBITDAY_TAGGED_USER_IDS_JSON', '');
$tag_match_type = optional('EXHIBITDAY_TAG_MATCH_TYPE', 'any');
require_condition(either(equal($tag_match_type, 'any'), equal($tag_match_type, 'all')), 'Choose any or all for EXHIBITDAY_TAG_MATCH_TYPE.');
$staff_query = ['$limit' => $selected_page_size];
if (is_present($selected_event_id)) {
$staff_query['filter_by_event_id'] = $selected_event_id;
}
$staff_offset = '0';
$staff_seen_ids = new_id_set();
print_value(json_decode('"Staff record ID\\tEvent ID"', false, 512, JSON_THROW_ON_ERROR));
while (true) {
$staff_query['$offset'] = $staff_offset;
$staff_response = call('staff_pages', $staff_query, null, null);
$staff_page = $staff_response["body"];
$staff_rows = items(field($staff_page, 'list_data'));
require_condition(equal(text(field($staff_page, 'records_found')), text(count($staff_rows))), 'records_found does not match this page\'s rows.');
require_condition(is_present(text(field($staff_page, 'total_records'))), 'The collection wrapper needs total_records.');
require_condition(either(equal(field($staff_page, 'has_more'), true), equal(field($staff_page, 'has_more'), false)), 'Expected a Boolean has_more value.');
foreach (items($staff_rows) as $staff_record) {
$staff_record_id = positive_id(text(field($staff_record, 'id')));
$staff_event_id = positive_id(text(field($staff_record, 'event_id')));
if (is_present($selected_event_id)) {
require_condition(equal($staff_event_id, $selected_event_id), 'A returned row belongs to a different Event.');
}
if (remember_id($staff_seen_ids, $staff_record_id)) {
print_value(concat($staff_record_id, concat(json_decode('"\\t"', false, 512, JSON_THROW_ON_ERROR), $staff_event_id)));
}
}
if (equal(field($staff_page, 'has_more'), false)) {
break;
}
require_condition(not_value(is_empty($staff_rows)), 'An empty page has has_more=true; stop and reconcile the query.');
$staff_offset = add_offset($staff_offset, count($staff_rows));
}
$travel_query = ['$limit' => $selected_page_size];
if (is_present($selected_event_id)) {
$travel_query['filter_by_event_id'] = $selected_event_id;
}
if (is_present($tagged_user_filter)) {
$travel_query['filter_by_tagged_user_ids'] = $tagged_user_filter;
$travel_query['filter_by_tagged_user_ids_match_type'] = $tag_match_type;
}
$travel_offset = '0';
$travel_seen_ids = new_id_set();
print_value(json_decode('"Travel record ID\\tEvent ID"', false, 512, JSON_THROW_ON_ERROR));
while (true) {
$travel_query['$offset'] = $travel_offset;
$travel_response = call('travel_pages', $travel_query, null, null);
$travel_page = $travel_response["body"];
$travel_rows = items(field($travel_page, 'list_data'));
require_condition(equal(text(field($travel_page, 'records_found')), text(count($travel_rows))), 'records_found does not match this page\'s rows.');
require_condition(is_present(text(field($travel_page, 'total_records'))), 'The collection wrapper needs total_records.');
require_condition(either(equal(field($travel_page, 'has_more'), true), equal(field($travel_page, 'has_more'), false)), 'Expected a Boolean has_more value.');
foreach (items($travel_rows) as $travel_record) {
$travel_record_id = positive_id(text(field($travel_record, 'id')));
$travel_event_id = positive_id(text(field($travel_record, 'event_id')));
if (is_present($selected_event_id)) {
require_condition(equal($travel_event_id, $selected_event_id), 'A returned row belongs to a different Event.');
}
if (remember_id($travel_seen_ids, $travel_record_id)) {
print_value(concat($travel_record_id, concat(json_decode('"\\t"', false, 512, JSON_THROW_ON_ERROR), $travel_event_id)));
}
}
if (equal(field($travel_page, 'has_more'), false)) {
break;
}
require_condition(not_value(is_empty($travel_rows)), 'An empty page has has_more=true; stop and reconcile the query.');
$travel_offset = add_offset($travel_offset, count($travel_rows));
}
}
if (realpath($_SERVER['SCRIPT_FILENAME'] ?? '') === __FILE__) main();
# Ruby 3.1+; standard library only. Set EXHIBITDAY_API_KEY before running.
require 'net/http'
require 'json'
require 'uri'
require 'csv'
require 'fileutils'
require 'securerandom'
require 'date'
require 'time'
require 'timeout'
BASE = 'https://api.exhibitday.com/v1'
SPEC = JSON.parse('{"preserveNumbers":true,"requests":{"staff_pages":{"method":"GET","path":"/events/staff"},"travel_pages":{"method":"GET","path":"/events/travel_reservations"}}}')
API_KEY = ENV.fetch('EXHIBITDAY_API_KEY')
raise 'Use the API key as one ASCII header value without control characters' if API_KEY.each_codepoint.any?{|point|point<32||point>126}
def decode_json(text)
if SPEC.fetch('preserveNumbers')
# Preserve JSON NUMBER lexemes for CSV, without replacing digits inside JSON strings.
text = text.gsub(/"(?:\\.|[^"\\])*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/) do |token|
token.start_with?('"') ? token : JSON.generate(token)
end
end
JSON.parse(text)
end
def transport(method, url, headers, data)
uri = URI(url)
request_type = { 'GET' => Net::HTTP::Get, 'POST' => Net::HTTP::Post,
'PATCH' => Net::HTTP::Patch, 'DELETE' => Net::HTTP::Delete }.fetch(method)
request = request_type.new(uri.request_uri, headers)
request.body = data unless data.nil?
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == 'https'
http.open_timeout = http.read_timeout = http.write_timeout = 30
http.max_retries = 0 # The outer loop owns the bounded retry policy.
response = http.start { |client| client.request(request) }
[response.code.to_i, response.body.to_s, response.each_header.to_h]
end
def retry_delay(headers, attempt)
value = headers['retry-after']
return 2**attempt if value.nil? || value.empty?
begin
[Float(value), 0].max
rescue ArgumentError, TypeError
begin
[Time.httpdate(value) - Time.now, 0].max
rescue ArgumentError
2**attempt
end
end
end
# An API error response. Branch on error_code (and status), never on the message text.
# uncertain is true when a PATCH or DELETE got no response or a server error: it may or may not have been applied.
class ApiError < RuntimeError
attr_reader :status, :error_code, :uncertain
def initialize(status, error_code, message, uncertain = false)
super(message)
@status = status
@error_code = error_code
@uncertain = uncertain
end
end
def call(name, params = {}, body = nil, key = nil)
route = SPEC.fetch('requests').fetch(name)
headers = { 'Authorization' => 'Bearer ' + API_KEY, 'Accept' => 'application/json' }
if route.fetch('method') == 'POST'
headers['Idempotency-Key'] = key || raise('Persist a logical create key before sending POST') # ONCE before retries.
end
data = body.nil? ? nil : JSON.generate(body)
headers['Content-Type'] = 'application/json' unless data.nil?
query = URI.encode_www_form(params)
url = BASE + route.fetch('path') + (query.empty? ? '' : '?' + query)
# Only GET has automatic retries in this workflow. A PATCH or DELETE that got no response or a
# server error is never resent blindly: it may already have been applied, so the caller reads the record first.
resend = route.fetch('method') == 'GET'
5.times do |attempt|
begin
status, raw, response_headers = transport(route.fetch('method'), url, headers, data)
rescue IOError, SystemCallError, Timeout::Error, SocketError
raise ApiError.new(0, nil, 'No response', true) unless resend
raise if attempt == 4
sleep(2**attempt)
next
end
response_headers = response_headers.transform_keys(&:downcase)
result = nil
unless status == 304 || raw.empty?
begin
result = decode_json(raw)
rescue JSON::ParserError, EncodingError
raise 'Expected a JSON success response' if status < 400
end
end
if status >= 500 && !resend
raise ApiError.new(status, result.is_a?(Hash) ? result['error_code'] : nil, "HTTP #{status}", true)
end
transient = resend && (status == 429 || (500..599).cover?(status))
if transient
raise 'Retry limit reached; check the outcome before starting a new create' if attempt == 4
sleep(retry_delay(response_headers, attempt))
next
end
if status >= 400
raise ApiError.new(status, nil, "HTTP #{status}") unless result.is_a?(Hash)
raise ApiError.new(status, result['error_code'], "#{result['error_code']} #{result['error_params'].inspect}: #{result['errors'].inspect} (request #{result['request_id']})")
end
return { status: status, body: result, headers: response_headers, raw: raw }
end
raise 'Retry limit reached'
end
def add_offset(offset,received)
result=Integer(offset)+received
raise "Cannot advance this int32 offset; reconcile the query" if received<=0 || result>2147483647
result.to_s
end
def concat(left,right)
left+right
end
def items(value)
raise "Expected a JSON array" unless value.is_a?(Array)
value
end
def count(value)
items(value).length
end
def either(left,right)
raise "Expected Boolean criteria" unless [true,false].include?(left) && [true,false].include?(right)
left || right
end
def equal(left,right)
left.class==right.class && left==right
end
def field(value,name)
raise "Missing response field: #{name}" unless value.is_a?(Hash) && value.key?(name)
value.fetch(name)
end
def is_empty(value)
count(value)==0
end
def is_present(value)
!value.nil? && value!=""
end
def new_id_set
{}
end
def not_value(value)
raise "Expected a Boolean" unless value==true || value==false
!value
end
def optional(name,fallback)
value=ENV[name]
value.nil? || value.empty? ? fallback : value
end
def page_size(value)
raise "Page size must be a positive int32" unless /\A[1-9][0-9]*\z/.match?(value) && Integer(value)<=2147483647
value
end
def positive_id(value)
raise "Use a positive record ID" unless /\A[1-9][0-9]*\z/.match?(value) && Integer(value)<=9223372036854775807
value
end
def print_value(value)
STDOUT.binmode.write((value.is_a?(String)?value:JSON.generate(value))+"\n")
end
def remember_id(seen,value)
return false if seen.key?(value)
seen[value]=true
true
end
def require_condition(value,message)
raise message unless value==true
end
def text(value)
return "" if value.nil?
return value.to_s if value.is_a?(String)||value.is_a?(Integer)||value==true||value==false
raise "Expected a scalar response value"
end
def main
selected_page_size = page_size(optional('EXHIBITDAY_PAGE_SIZE', '100'))
selected_event_id = optional('EXHIBITDAY_EVENT_ID', '')
if is_present(selected_event_id)
selected_event_id = positive_id(selected_event_id)
end
tagged_user_filter = optional('EXHIBITDAY_TAGGED_USER_IDS_JSON', '')
tag_match_type = optional('EXHIBITDAY_TAG_MATCH_TYPE', 'any')
require_condition(either(equal(tag_match_type, 'any'), equal(tag_match_type, 'all')), 'Choose any or all for EXHIBITDAY_TAG_MATCH_TYPE.')
staff_query = {'$limit' => selected_page_size}
if is_present(selected_event_id)
staff_query['filter_by_event_id'] = selected_event_id
end
staff_offset = '0'
staff_seen_ids = new_id_set()
print_value(JSON.parse('"Staff record ID\\tEvent ID"'))
while true
staff_query['$offset'] = staff_offset
staff_response = call('staff_pages', staff_query, nil, nil)
staff_page = staff_response.fetch(:body)
staff_rows = items(field(staff_page, 'list_data'))
require_condition(equal(text(field(staff_page, 'records_found')), text(count(staff_rows))), 'records_found does not match this page\'s rows.')
require_condition(is_present(text(field(staff_page, 'total_records'))), 'The collection wrapper needs total_records.')
require_condition(either(equal(field(staff_page, 'has_more'), true), equal(field(staff_page, 'has_more'), false)), 'Expected a Boolean has_more value.')
items(staff_rows).each do |staff_record|
staff_record_id = positive_id(text(field(staff_record, 'id')))
staff_event_id = positive_id(text(field(staff_record, 'event_id')))
if is_present(selected_event_id)
require_condition(equal(staff_event_id, selected_event_id), 'A returned row belongs to a different Event.')
end
if remember_id(staff_seen_ids, staff_record_id)
print_value(concat(staff_record_id, concat(JSON.parse('"\\t"'), staff_event_id)))
end
end
if equal(field(staff_page, 'has_more'), false)
break
end
require_condition(not_value(is_empty(staff_rows)), 'An empty page has has_more=true; stop and reconcile the query.')
staff_offset = add_offset(staff_offset, count(staff_rows))
end
travel_query = {'$limit' => selected_page_size}
if is_present(selected_event_id)
travel_query['filter_by_event_id'] = selected_event_id
end
if is_present(tagged_user_filter)
travel_query['filter_by_tagged_user_ids'] = tagged_user_filter
travel_query['filter_by_tagged_user_ids_match_type'] = tag_match_type
end
travel_offset = '0'
travel_seen_ids = new_id_set()
print_value(JSON.parse('"Travel record ID\\tEvent ID"'))
while true
travel_query['$offset'] = travel_offset
travel_response = call('travel_pages', travel_query, nil, nil)
travel_page = travel_response.fetch(:body)
travel_rows = items(field(travel_page, 'list_data'))
require_condition(equal(text(field(travel_page, 'records_found')), text(count(travel_rows))), 'records_found does not match this page\'s rows.')
require_condition(is_present(text(field(travel_page, 'total_records'))), 'The collection wrapper needs total_records.')
require_condition(either(equal(field(travel_page, 'has_more'), true), equal(field(travel_page, 'has_more'), false)), 'Expected a Boolean has_more value.')
items(travel_rows).each do |travel_record|
travel_record_id = positive_id(text(field(travel_record, 'id')))
travel_event_id = positive_id(text(field(travel_record, 'event_id')))
if is_present(selected_event_id)
require_condition(equal(travel_event_id, selected_event_id), 'A returned row belongs to a different Event.')
end
if remember_id(travel_seen_ids, travel_record_id)
print_value(concat(travel_record_id, concat(JSON.parse('"\\t"'), travel_event_id)))
end
end
if equal(field(travel_page, 'has_more'), false)
break
end
require_condition(not_value(is_empty(travel_rows)), 'An empty page has has_more=true; stop and reconcile the query.')
travel_offset = add_offset(travel_offset, count(travel_rows))
end
end
main if $PROGRAM_NAME == __FILE__
// Go 1.18+; standard library only. Set EXHIBITDAY_API_KEY.
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"time"
)
const base = "https://api.exhibitday.com/v1"
const specification = "{\"preserveNumbers\":true,\"requests\":{\"staff_pages\":{\"method\":\"GET\",\"path\":\"/events/staff\"},\"travel_pages\":{\"method\":\"GET\",\"path\":\"/events/travel_reservations\"}}}"
var spec map[string]any
var apiKey string
var client = &http.Client{Timeout: 30 * time.Second, CheckRedirect: func(req *http.Request, via []*http.Request) error { return http.ErrUseLastResponse }}
var send = client.Do
type result struct { status int; body any; headers http.Header; raw []byte }
// An API error response (raised with panic). Branch on code (and status), never on the message text.
// uncertain is true when a PATCH or DELETE got no response or a server error: it may or may not have been applied.
type apiError struct { status int; code string; message string; uncertain bool }
func (failure apiError) Error() string { return failure.message }
func required(name string) string {
value := os.Getenv(name); if strings.TrimSpace(value) == "" { panic("Set " + name) }; return value
}
func text(value any) string { if value == nil { return "" }; return fmt.Sprint(value) }
func object(value any) map[string]any { if value == nil { return map[string]any{} }; return value.(map[string]any) }
func array(value any) []any { if value == nil { return nil }; return value.([]any) }
func decode(raw []byte) (any, error) {
var value any
decoder := json.NewDecoder(bytes.NewReader(raw)); decoder.UseNumber() // keeps exact decimal tokens
err := decoder.Decode(&value); return value, err
}
func call(name string, query map[string]string, body any, key string) result {
route := object(object(spec["requests"])[name]); method := text(route["method"])
headers := map[string]string{"Authorization": "Bearer " + apiKey, "Accept": "application/json"}
if method == "POST" { if key == "" { panic("Persist a logical create key before sending POST") }; headers["Idempotency-Key"] = key } // before retry loop
var data []byte
if body != nil { var err error; data, err = json.Marshal(body); if err != nil { panic(err) }; headers["Content-Type"] = "application/json" }
values := url.Values{}; for k,v := range query { values.Set(k,v) }
address := base + text(route["path"]); if len(values) > 0 { address += "?" + values.Encode() }
// Only GET has automatic retries in this workflow. A PATCH or DELETE that got no response or a
// server error is never resent blindly: it may already have been applied, so the caller reads the record first.
resend := method == "GET"
for attempt := 0; attempt < 5; attempt++ {
request, err := http.NewRequest(method, address, bytes.NewReader(data)); if err != nil { panic(err) }
for k,v := range headers { request.Header.Set(k,v) }
response, err := send(request)
if err != nil { if !resend { panic(apiError{0, "", "No response", true}) }; if attempt == 4 { panic(err) }; time.Sleep(time.Second*time.Duration(1<<attempt)); continue }
raw, readErr := io.ReadAll(response.Body); response.Body.Close()
if readErr != nil { if !resend { panic(apiError{0, "", "No response", true}) }; if attempt == 4 { panic(readErr) }; time.Sleep(time.Second*time.Duration(1<<attempt)); continue }
var parsed any
if response.StatusCode != 304 && len(raw)>0 {
parsed, err = decode(raw)
if err != nil && response.StatusCode < 400 { panic("Expected a JSON success response") }
}
errorBody, _ := parsed.(map[string]any)
if response.StatusCode >= 500 && !resend { panic(apiError{response.StatusCode, text(errorBody["error_code"]), fmt.Sprintf("HTTP %d", response.StatusCode), true}) }
retry := resend && (response.StatusCode == 429 || response.StatusCode >= 500)
if retry {
if attempt == 4 { panic("Retry limit reached; check the outcome before starting a new create") }
seconds := float64(int64(1)<<attempt)
if value, err := strconv.ParseFloat(response.Header.Get("Retry-After"),64); err == nil && value >= 0 { seconds = value }
time.Sleep(time.Duration(seconds*float64(time.Second))); continue
}
if response.StatusCode >= 400 { panic(apiError{response.StatusCode, text(errorBody["error_code"]), fmt.Sprintf("HTTP %d: %v (request %v)",response.StatusCode,errorBody["error_code"],errorBody["request_id"]), false}) }
return result{response.StatusCode, parsed, response.Header, raw}
}
panic("Retry limit reached")
}
func add_offset(offset string,received int64)string{previous,err:=strconv.ParseInt(offset,10,32);if err!=nil||received<=0||received>2147483647-previous{panic("Cannot advance this int32 offset; reconcile the query")};return strconv.FormatInt(previous+received,10)}
func concat(left,right string)string{return left+right}
func items(value any)[]any{result,ok:=value.([]any);if !ok{panic("Expected a JSON array")};return result}
func count(value any)int64{return int64(len(items(value)))}
func either(left,right bool)bool{return left||right}
func equal(left,right any)bool{switch a:=left.(type){case string:b,ok:=right.(string);return ok&&a==b;case bool:b,ok:=right.(bool);return ok&&a==b;case int64:b,ok:=right.(int64);return ok&&a==b};return left==nil&&right==nil}
func field(value any,name string)any{obj,ok:=value.(map[string]any);if !ok{panic("Missing response object")};item,found:=obj[name];if !found{panic("Missing response field: "+name)};return item}
func is_empty(value any)bool{return count(value)==0}
func is_present(value string)bool{return value!=""}
func new_id_set()map[string]bool{return map[string]bool{}}
func not_value(value bool)bool{return !value}
func optional(name,fallback string)string{value:=os.Getenv(name);if value==""{return fallback};return value}
func page_size(value string)string{valid:=len(value)>0&&value[0]!='0';for _,ch:=range value{valid=valid&&ch>='0'&&ch<='9'};size,err:=strconv.ParseInt(value,10,32);if !valid||err!=nil||size<=0{panic("Page size must be a positive int32")};return value}
func positive_id(value string)string{valid:=len(value)>0&&value[0]!='0';for _,ch:=range value{valid=valid&&ch>='0'&&ch<='9'};id,err:=strconv.ParseInt(value,10,64);if !valid||err!=nil||id<=0{panic("Use a positive record ID")};return value}
func print_value(value any){if result,ok:=value.(string);ok{fmt.Println(result);return};raw,err:=json.Marshal(value);if err!=nil{panic(err)};fmt.Println(string(raw))}
func remember_id(seen map[string]bool,value string)bool{if seen[value]{return false};seen[value]=true;return true}
func require_condition(value bool,message string){if !value{panic(message)}}
func workflow() {
selected_page_size := page_size(optional("EXHIBITDAY_PAGE_SIZE", "100"))
selected_event_id := optional("EXHIBITDAY_EVENT_ID", "")
if is_present(selected_event_id) {
selected_event_id = positive_id(selected_event_id)
}
tagged_user_filter := optional("EXHIBITDAY_TAGGED_USER_IDS_JSON", "")
tag_match_type := optional("EXHIBITDAY_TAG_MATCH_TYPE", "any")
require_condition(either(equal(tag_match_type, "any"), equal(tag_match_type, "all")), "Choose any or all for EXHIBITDAY_TAG_MATCH_TYPE.")
staff_query := map[string]string{"$limit": selected_page_size}
if is_present(selected_event_id) {
staff_query["filter_by_event_id"] = selected_event_id
}
staff_offset := "0"
staff_seen_ids := new_id_set()
print_value("Staff record ID\tEvent ID")
for true {
staff_query["$offset"] = staff_offset
staff_response := call("staff_pages", staff_query, nil, "")
staff_page := staff_response.body
staff_rows := items(field(staff_page, "list_data"))
require_condition(equal(text(field(staff_page, "records_found")), text(count(staff_rows))), "records_found does not match this page's rows.")
require_condition(is_present(text(field(staff_page, "total_records"))), "The collection wrapper needs total_records.")
require_condition(either(equal(field(staff_page, "has_more"), true), equal(field(staff_page, "has_more"), false)), "Expected a Boolean has_more value.")
for _, staff_record := range items(staff_rows) {
staff_record_id := positive_id(text(field(staff_record, "id")))
staff_event_id := positive_id(text(field(staff_record, "event_id")))
if is_present(selected_event_id) {
require_condition(equal(staff_event_id, selected_event_id), "A returned row belongs to a different Event.")
}
if remember_id(staff_seen_ids, staff_record_id) {
print_value(concat(staff_record_id, concat("\t", staff_event_id)))
}
}
if equal(field(staff_page, "has_more"), false) {
break
}
require_condition(not_value(is_empty(staff_rows)), "An empty page has has_more=true; stop and reconcile the query.")
staff_offset = add_offset(staff_offset, count(staff_rows))
}
travel_query := map[string]string{"$limit": selected_page_size}
if is_present(selected_event_id) {
travel_query["filter_by_event_id"] = selected_event_id
}
if is_present(tagged_user_filter) {
travel_query["filter_by_tagged_user_ids"] = tagged_user_filter
travel_query["filter_by_tagged_user_ids_match_type"] = tag_match_type
}
travel_offset := "0"
travel_seen_ids := new_id_set()
print_value("Travel record ID\tEvent ID")
for true {
travel_query["$offset"] = travel_offset
travel_response := call("travel_pages", travel_query, nil, "")
travel_page := travel_response.body
travel_rows := items(field(travel_page, "list_data"))
require_condition(equal(text(field(travel_page, "records_found")), text(count(travel_rows))), "records_found does not match this page's rows.")
require_condition(is_present(text(field(travel_page, "total_records"))), "The collection wrapper needs total_records.")
require_condition(either(equal(field(travel_page, "has_more"), true), equal(field(travel_page, "has_more"), false)), "Expected a Boolean has_more value.")
for _, travel_record := range items(travel_rows) {
travel_record_id := positive_id(text(field(travel_record, "id")))
travel_event_id := positive_id(text(field(travel_record, "event_id")))
if is_present(selected_event_id) {
require_condition(equal(travel_event_id, selected_event_id), "A returned row belongs to a different Event.")
}
if remember_id(travel_seen_ids, travel_record_id) {
print_value(concat(travel_record_id, concat("\t", travel_event_id)))
}
}
if equal(field(travel_page, "has_more"), false) {
break
}
require_condition(not_value(is_empty(travel_rows)), "An empty page has has_more=true; stop and reconcile the query.")
travel_offset = add_offset(travel_offset, count(travel_rows))
}
}
func header_key(value string)string{for _,ch:=range value{if ch<32||ch>126{panic("Use the API key as one ASCII header value without control characters")}};return value}
func main(){apiKey=header_key(required("EXHIBITDAY_API_KEY"));if err:=json.Unmarshal([]byte(specification),&spec);err!=nil{panic(err)};workflow()}
Things to keep in mind
- Lists leave out records on an Event tab that is hidden. If you filter a list to one Event whose tab is hidden, the response includes a warning that names the tab. Tasks are the exception: hiding an Event's Tasks tab does not hide its Tasks.
- Staff uses
filter_by_attendee_user_idsand matches any listed person. Travel, Playbook Activities and Event Misc. Expenses/Credits usefilter_by_tagged_user_idswithfilter_by_tagged_user_ids_match_type. Send an ID array as JSON text in the GET query string. - People filters match saved assignments or tags, including IDs of inactive or removed people that are still on the record. IDs with no saved match return nothing. The API returns only records your key can read.
- Records can shift between pages when someone adds, removes or edits them. Keep each ID once and reconcile longer exports when needed.
- If a page is empty and
has_moreis true, investigate the result before continuing. - Related data options vary by endpoint. Turn on only what your report uses.
Full workspace-wide Travel example without a people filter
Example response
{
"list_type": "travel_reservation",
"list_data": [
{
"id": 201,
"event_id": 5001,
"event_name": "Spring Expo 2030",
"reservation_type_id": 6,
"booking_status_id": 20,
"book_by_date": null,
"date_booked": null,
"booking_url": null,
"cancellation_instructions": "",
"vehicle_drop_off_location": null,
"reservation_number": null,
"origin_vendor_name": "Spring Expo Conference Hotel",
"origin_flight_number": null,
"origin_reservation_item_info": null,
"origin_checkin_location": null,
"origin_checkin_date": "2030-01-14",
"origin_checkin_time": null,
"origin_reservation_details": null,
"origin_destination_location": null,
"origin_destination_date": null,
"origin_destination_time": null,
"origin_reservation_final_details": null,
"return_vendor_name": null,
"return_flight_number": null,
"return_reservation_item_info": null,
"return_checkin_location": null,
"return_checkin_date": "2030-01-17",
"return_checkin_time": null,
"return_reservation_details": null,
"return_destination_location": null,
"return_destination_date": null,
"return_destination_time": null,
"return_reservation_final_details": null,
"origin_vendor_address": null,
"notes": "",
"payment_status_id": 0,
"payment_due_date": null,
"next_payment_due_date": null,
"payment_notes": null,
"invoice_attachment": null,
"reservation_type": "Hotel",
"reservation_group": "Lodging",
"booking_status": "Booked",
"payment_status": {
"id": 0,
"name": "N/A"
},
"cost": {
"amount": 0.00,
"cost_center_breakdown": []
},
"tagged_users": [
{
"id": "11111111-2222-4333-8444-555555555555",
"first_name": "Alex",
"last_name": "Morgan",
"display_name": "Alex Morgan",
"email": "alex@example.invalid",
"type": "user",
"workspace_role": "team_member",
"is_active": true
},
{
"id": "66666666-7777-4888-8999-000000000000",
"first_name": "Jordan",
"last_name": "Lee",
"display_name": "Jordan Lee",
"email": "jordan@example.invalid",
"type": "user",
"workspace_role": "team_member",
"is_active": true
}
],
"created_by": {
"id": null,
"first_name": "ExhibitDay",
"last_name": "API",
"display_name": "ExhibitDay API",
"email": null,
"type": null,
"workspace_role": null,
"is_active": true
}
},
{
"id": 202,
"event_id": 5002,
"event_name": "Lakeshore Expo 2030",
"reservation_type_id": 6,
"booking_status_id": 20,
"book_by_date": null,
"date_booked": null,
"booking_url": null,
"cancellation_instructions": "",
"vehicle_drop_off_location": null,
"reservation_number": null,
"origin_vendor_name": "Lakeshore Convention Hotel",
"origin_flight_number": null,
"origin_reservation_item_info": null,
"origin_checkin_location": null,
"origin_checkin_date": "2030-02-11",
"origin_checkin_time": null,
"origin_reservation_details": null,
"origin_destination_location": null,
"origin_destination_date": null,
"origin_destination_time": null,
"origin_reservation_final_details": null,
"return_vendor_name": null,
"return_flight_number": null,
"return_reservation_item_info": null,
"return_checkin_location": null,
"return_checkin_date": "2030-02-14",
"return_checkin_time": null,
"return_reservation_details": null,
"return_destination_location": null,
"return_destination_date": null,
"return_destination_time": null,
"return_reservation_final_details": null,
"origin_vendor_address": null,
"notes": "",
"payment_status_id": 0,
"payment_due_date": null,
"next_payment_due_date": null,
"payment_notes": null,
"invoice_attachment": null,
"reservation_type": "Hotel",
"reservation_group": "Lodging",
"booking_status": "Booked",
"payment_status": {
"id": 0,
"name": "N/A"
},
"cost": {
"amount": 0.00,
"cost_center_breakdown": []
},
"tagged_users": [
{
"id": "11111111-2222-4333-8444-555555555555",
"first_name": "Alex",
"last_name": "Morgan",
"display_name": "Alex Morgan",
"email": "alex@example.invalid",
"type": "user",
"workspace_role": "team_member",
"is_active": true
},
{
"id": "66666666-7777-4888-8999-000000000000",
"first_name": "Jordan",
"last_name": "Lee",
"display_name": "Jordan Lee",
"email": "jordan@example.invalid",
"type": "user",
"workspace_role": "team_member",
"is_active": true
}
],
"created_by": {
"id": null,
"first_name": "ExhibitDay",
"last_name": "API",
"display_name": "ExhibitDay API",
"email": null,
"type": null,
"workspace_role": null,
"is_active": true
}
}
],
"records_found": 2,
"total_records": 3,
"has_more": true
}
{
"status_code": 400,
"status": "Bad Request",
"message": "X-HTTP-Method-Override: hTTP method override is not supported.",
"error_code": "invalid_request",
"errors": [
"Send the documented HTTP method directly. X-HTTP-Method-Override cannot change a request's HTTP method."
],
"error_params": [
"X-HTTP-Method-Override"
],
"request_id": "0123456789abcdef0123456789abcdef"
}
{
"status_code": 400,
"status": "Bad Request",
"message": "filter_by_tagged_user_ids must be one user ID or an array of user IDs. Each ID is text of 1 to 128 characters; numbers, true/false, null, blank values and objects are not IDs. For example, send \"user-id\" or [\"user-id\",\"other-user-id\"].",
"error_code": "invalid_request",
"errors": [
"filter_by_tagged_user_ids must be one user ID or an array of user IDs. Each ID is text of 1 to 128 characters; numbers, true/false, null, blank values and objects are not IDs. For example, send \"user-id\" or [\"user-id\",\"other-user-id\"]."
],
"error_params": [
"filter_by_tagged_user_ids"
],
"request_id": "0123456789abcdef0123456789abcdef"
}
{
"status_code": 401,
"status": "Unauthorized",
"message": "No API key was provided. Send your key in the Authorization header as 'Bearer YOUR_API_KEY'. Alternatively, you can use the api_key parameter.",
"error_code": "missing_api_key",
"errors": [
"Copy the key from Workspace Settings > API & Integrations > API Access in ExhibitDay."
],
"error_params": [
"api_key"
],
"request_id": "0123456789abcdef0123456789abcdef"
}
{
"status_code": 401,
"status": "Unauthorized",
"message": "The API key is not valid. Check that you copied the whole key from Workspace Settings > API & Integrations > API Access, then send it in the Authorization header as 'Bearer YOUR_API_KEY'. Alternatively, you can use the api_key parameter.",
"error_code": "invalid_api_key",
"errors": [
"Check that you sent the whole key. If it was regenerated, use the current key from Workspace Settings > API & Integrations > API Access."
],
"error_params": [
"api_key"
],
"request_id": "0123456789abcdef0123456789abcdef"
}
{
"status_code": 401,
"status": "Unauthorized",
"message": "Access to the ExhibitDay API is not enabled for your workspace. Please contact support@exhibitday.com to enable API Access. Once access is enabled, send your key in the Authorization header as 'Bearer YOUR_API_KEY'.",
"error_code": "api_access_disabled",
"errors": [
"Nothing was read or changed."
],
"error_params": [
"api_key"
],
"request_id": "0123456789abcdef0123456789abcdef"
}
{
"status_code": 401,
"status": "Unauthorized",
"message": "The API key is not valid for this request. Send your current key in the Authorization header as 'Bearer YOUR_API_KEY'.",
"error_code": "invalid_api_key",
"errors": [
"The API key is not valid for this request. Send your current key in the Authorization header as 'Bearer YOUR_API_KEY'."
],
"error_params": [
"api_key"
],
"request_id": "0123456789abcdef0123456789abcdef"
}
{
"status_code": 401,
"status": "Unauthorized",
"message": "Access to the ExhibitDay API is not enabled for your workspace. Please contact support@exhibitday.com to enable API Access. Once access is enabled, send your key in the Authorization header as 'Bearer YOUR_API_KEY'.",
"error_code": "api_access_disabled",
"errors": [
"Access to the ExhibitDay API is not enabled for your workspace. Please contact support@exhibitday.com to enable API Access. Once access is enabled, send your key in the Authorization header as 'Bearer YOUR_API_KEY'."
],
"error_params": [
"api_key"
],
"request_id": "0123456789abcdef0123456789abcdef"
}
{
"status_code": 404,
"status": "Not Found",
"message": "The invoice attachment is not available under this owning record.",
"error_code": "not_found",
"errors": [
"The invoice attachment is not available under this owning record."
],
"error_params": [],
"request_id": "0123456789abcdef0123456789abcdef"
}
{
"status_code": 409,
"status": "Conflict",
"message": "The invoice attachment or its owning record changed or has conflicting saved information. Retrieve the current record before retrying.",
"error_code": "record_changed",
"errors": [
"The invoice attachment or its owning record changed or has conflicting saved information. Retrieve the current record before retrying."
],
"error_params": [],
"request_id": "0123456789abcdef0123456789abcdef"
}
{
"status_code": 409,
"status": "Conflict",
"message": "The Travel entries changed while they were being read. Send the GET request again.",
"error_code": "record_changed",
"errors": [
"The Travel entries changed while they were being read. Send the GET request again."
],
"error_params": [],
"request_id": "0123456789abcdef0123456789abcdef"
}
{
"status_code": 429,
"status": "Too Many Requests",
"message": "Error 429 - Too Many Requests",
"error_code": "rate_limited",
"errors": [
"Error 429 - Too Many Requests"
],
"error_params": [],
"request_id": "0123456789abcdef0123456789abcdef"
}
{
"status_code": 500,
"status": "Unexpected Internal Error",
"message": "An unexpected error occurred. Please try again later.",
"error_code": "internal_error",
"errors": [
"An unexpected error occurred. Please try again later."
],
"error_params": [],
"request_id": "0123456789abcdef0123456789abcdef"
}
{
"status_code": 500,
"status": "Unexpected Internal Error",
"message": "An unexpected error occurred. Please try again later.",
"error_code": "internal_error",
"errors": [
"An unexpected error occurred. Please try again later."
],
"error_params": [],
"request_id": "0123456789abcdef0123456789abcdef"
}
{
"status_code": 500,
"status": "Unexpected Internal Error",
"message": "An unexpected error occurred. Please try again later.",
"error_code": "internal_error",
"errors": [
"Check whether your change was saved before trying again."
],
"error_params": [],
"request_id": "0123456789abcdef0123456789abcdef"
}