Skip to content

Instantly share code, notes, and snippets.

@airbnb-robot
Created March 26, 2021 17:47
Show Gist options
  • Save airbnb-robot/af6e9068639733bff79d4e3773a8d1dc to your computer and use it in GitHub Desktop.
Save airbnb-robot/af6e9068639733bff79d4e3773a8d1dc to your computer and use it in GitHub Desktop.
README from the code review app.

code-review-app

An application for conducting code review interviews

Backstory

This service ensures we are following the laws of the City of Atlantis with respect to vacation rental properties. Atlantis requires that:

  • Every bookable listing within their City limits has a valid registration number. This is obtained by hosts via an in-person application process. A single registration number applies to a single property and host, regardless of which platform they are listing that property on (Airbnb or otherwise), or how many listings apply to that property.
  • Every time a listing is booked, we must check with the City of Atlantis to verify that the given registration number is allowed to take a new reservation.

API

/register_listing

This endpoint calls the City of Atlantis' servers with a registration_number to get the property's short-term rental status. The (listing_id, registration_number, status) is then stored in a DB.

Parameters:

parameter_name type required description
listing_id long yes The Airbnb listing id being registered with the city of Atlantis
registration_number String yes The registration number provided to hosts by the city of Atlantis after registering their property.

Response:

A boolean (true or false) specifying whether or not the listing was registered.

/get_status

This endpoint fetches the listing's rental status as reported by the city of Atlantis. For eventually consistent reads, status is fetched from a local DB, otherwise Atlantis APIs are called for the latest data.

A background job synchronizes data with Atlantis' servers daily, so data should never be more than 24 hours stale. Please use EVENTUAL consistency as much as possible to reduce load on Atlantis servers.

Parameters:

parameter_name type required description
listing_id long yes The Airbnb listing id whose status is being fetched.
consistency String no The consistency level required when fetching the listing's property status. Must be either EVENTUAL or STRONG. Defaults to EVENTUAL.

Response:

A string representing the listing's status. The string will be one of: APPROVED, DENIED, ERRORED, NOT_SYNCED.

/sync_listing

This endpoint calls the City of Atlantis to get the most up-to-date rental status and update our DB. Like /register_listing for listings that have already been register. This endpoint should only be called by our team. It's used to sync data daily, ensuring that eventually-consistent reads are at most 24 hours stale.

Parameters:

parameter_name type required description
listing_id long yes The Airbnb listing id whose status is being updated.

Response:

A boolean (true or false) specifying whether or not the listing was successfully updated to reflect the source of truth reported by Atlantis' servers.

@jbellenger
Copy link

Minor typo? "have already been register" looks like it should be "have already been registered"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment