Documentation

api.reservations.fetch

Fetch dicts of all reservations in the filters given.

Important

This function is very expensive to call with certain parameters and should only be used when none of the other api.reservations functions can provide you with the data you need. Calling it with too liberal of a filter may result in your script running out of time or memory, which will prevent users from being able to use your site.

All API calls are executed from that database perspective of the reservation having already been made, so the current reservation being made will be counted in the results.

Rate metadata can be searched using rate_meta_data_query and rate_meta_data_query_path. For example, if you want to look for all reservations matching a rate with "foo" in the the metadata {"bar": { "moo": "..." }}, you would set rate_meta_data_query to "foo" and rate_meta_data_query_path to ["bar", "moo"].

To speed up your queries, you can choose to select which data to return in the dictionary. attribs allows you to do so. For example, if you want to only return the reservation_id and reserved_for columns, you would just set attribs to be ["reservation_id", "reserved_for"].

Arguments:

def api.reservations.fetch(
  account_number: str = None, # Filter on account number set on reservation
  attribs: list of str = None, # Which attributes to return in the dictionary
  end: datetime = None, # End time of filter
  include_blocked: bool = False, # Boolean for including reservations of resources that block any filtered resources
  include_cancelled: bool = False, # Boolean for including cancelled reservations.
  include_checked_in: bool = True, # Boolean for including checked in reservations
  include_filtered_user_if_guest: bool = True,
  include_ical_feeds: bool = False, # Boolean for including ical feeds
  include_maintenance: bool = False, # Boolean for blocking maintenance
  include_maintenance_nonblocking: bool = False, # Boolean to included nonblocking if above is true
  include_not_checked_in: bool = True, # Boolean for all reservations not checked in
  include_templates: bool = True, # Boolean for including template reservations
  limit: dec = None, # Number of items to return (paginations)
  offset: dec = None, # Offset for pagination
  requests: bool = None, # Boolean for filtering on requests instead of reservations
  rate_meta_data_query: str = None, # The query to match in rate metadata
  rate_meta_data_query_path: list of str = None, # The path to match in rate metadata
  reservable_id: str = None, # Resource ID
  start: datetime = None, # Start time of filter
  tags: list of str = None, # Tags to filter on (case insensitive)
  user_id: str = None, # User ID to filter on
  usergroup_name: str = None, # User group name to filter on (case insensitive)
):

Returns a list of dicts containing reservation data.

Example:

fetched = api.reservations.fetch(reservable_id="foo") # fetched = [ <dict> ]