Skip to content

Instantly share code, notes, and snippets.

@hoan006
Last active March 15, 2019 10:42
Show Gist options
  • Save hoan006/9f51dd01a5080acba7ac6e75dfb06b02 to your computer and use it in GitHub Desktop.
Save hoan006/9f51dd01a5080acba7ac6e75dfb06b02 to your computer and use it in GitHub Desktop.
Christina's API specificication

Authentication

This section describes how you can authenticate your requests with Christina’s.

You must use Signature Authentication with our provided HMAC key to sign your request and embed in the Authorization header.

For example:

Authorization: Signature keyId="christinas_api",algorithm="hmac-sha256",headers="host url method date content-type body",delimiter="|",signature="aVp9aJ/LB4uuZIbWPXMsK9EwMHt3I09VYHWkVIxUEZE27ysJ4nRkz3KbmlOTcipX/P7x0CWTepF2E3sNxn/96oHxA9BTwGMv+3ohGXItTHuZcqcWuWOF0uFXozWAZDf6S84ifCNqa6h/VyWcw8BnLEk3yYZH0VEbzfehaV8eGzO4d6RiGsTTfQmpN762lKbyJzWI5OXD4+/A2B/3SuPYFd1Y4ar5T+PtKL5H8tt4kYNEVXuEDG/PfgEXJ9fyJ/xX2BAlsxRqKwN0xPAui+KvBqnOEtkCuKb9/ylajgolCTXWOgEX0apKvmjAgcu4231Q2WQ4sQ99IyQTFjKzgZTz0w=="

This header includes:

  • keyId — Currently, only christinas_api
  • algorithm — Currently, only hmac-sha256
  • headers — List of items used to construct the payload:
    • url — Endpoint relative url
    • methodGET, POST, PUT, or DELETE
    • host — The host's name as specified in the dev portal without the port
    • body — Request content
    • date and content-type — Respective headers.
  • delimiter — Currently, only |
  • signature — As computed from above fields.

To verify the signature, the client construct the payload in the order specified by the headers parameter, delimited by the delimiter.

Check Availability API

You can use this endpoint to check availability for a given listing ID and date range.

GET /integrations/luxstay/check_availability/:listing_id/:start_date/:end_date/

Notes The endpoint requires an ending slash.

Request URL ID

Parameter Description
listing_id integer, required Luxstay listing ID
start_date string, required Start date range to check availability, in ISO 8601 YYYY-MM-DD format
end_date string, required End date range to check availability, in ISO 8601 YYYY-MM-DD format

Example Response

{
  "calendar": {
    "days": [
      {
        "date":"2019-01-01",
        "availability":"available",
        "available_count":2
      },
      {
        "date":"2019-01-02",
        "availability":"unavailable",
        "available_count":0
      },
      {
        "date":"2019-01-03",
        "availability":"unavailable",
        "available_count":4
      }
    ]
  },
  "metadata": {
  }
}

Response Detail

Parameter Description
date Date in ISO 8601 YYYY-MM-DD format
availability Either available or unavailable
available_count How many rooms are availabile for this date. Please note that even if there are rooms available, Christina's may still decide to block availability for internal reasons.

Make Reservation API

You can use this endpoint to make a reservation for a given listing ID and date range.

POST /integrations/luxstay/make_reservation/:listing_id/:start_date/:nights/

Notes The endpoint requires an ending slash.

Request URL ID

Parameter Description
listing_id integer, required Luxstay listing ID
start_date string, required The reservation start date, in ISO 8601 YYYY-MM-DD format
nights integer, required The number of nights in the reservation

Request Body Parameters

Parameter Description
reservation_code string, required Guest reservation code on Luxstay
guest_name string, required Name of the main guest who will stay at Christina's
number_of_guests integer, required Number of people who will stay at Christina's
contact_email string, optional Main guest personal email
phone_number string, optional Main guest phone number
notes string, optional Special notes from guest or Luxstay
earning float, required Christina's earning in USD from Luxstay for this reservation

Notes Luxstay can provide more parameters as necessary, but have to provide required fields above.

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