API - digitalfabrik/coldaid-backend GitHub Wiki

Accommodations

The accommodations endpoint can be found at the following url:
/api/<region_slug>/<language_code>/accommodations
As an example for the cms running on localhost the url for the region Augsburg in English could look like this:
GET localhost:8000/api/augsburg/en-us/accommodations

The reply will be a JSON list of all accommodations of the region with the following fields:

  • name (String) : The name of the accommodation
  • current_language (String): The currently displayed language of the current accommodation (as language code). If the accommodation doesn't have the language that was requested by request then it falls back to the default language of the region the accommodation belongs to. So it could happen that an accommodation will be displayed in German even though it was requested in English because of this.
  • description (HTML): The description of the accommodation as html markup since the description is a rich text field with formatting and styling.
  • short_description (String): This field is the short description of the accommodation
  • opening_hours (Object):
    • from (String): Time string of the start of the opening time in format hh:mm:ss (24 hour format)
    • to (String) : Time string of the closing time of the accommodation in format hh:mm:ss (24 hour format)
  • intake_hours (Object):
    • from (String): Time string of the start of the intake timeframe in format hh:mm:ss (24 hour format)
    • to (String) : Time string of the ending of the intake timeframe of the accommodation in format hh:mm:ss (24 hour format)
  • address (Object):
    • street (String)
    • plz (String)
    • city (String)
    • geo (Object): the geolocation
      • lat (float): the latitude
      • long (float): the longitude
  • phone (Object)
    • home (String)
    • mobile (String)
  • sanitary_amenities (Object)
    • wc (bool): if toilets are available
    • shower (bool): if showers are available
  • rules (Object): List of rules currently hard coded could get more fields in future versions
    • animals (bool): if animals are allowed
    • shelter_seeking_person_intoxicated (bool): if intoxiated people are allowed
    • female_only (bool): if the accommodation is female only
    • families_welcome (bool): if families are allowed in the accommodation
    • male_only (bool): if the accommodation is male only
    • kids_welcome (bool): if kids are allowed in the accommodation
  • spoken_languages (List): the languages spoken in the accommodation is an array list where the objects have the following fields:
    • translated (String): language as it is translated into English
    • code (String): the language code (en-us for english or de-de for German for example)
    • native (String): the native name of the language (Deutsch for German for example)
  • institution (Object): the institution the accommodation belongs to
    • slug (String): a unique name of the accommodation can be used to build a link to the info
    • name (String): name of the institution
    • thumbnail (String): link to the thumbnail of the organization
  • beds
    • target_group (String): the target group for this bed (i.e. female, male, with animals etc)
    • num_beds (integer): the total amounts of beds available
    • num_free_beds (integer): the number of beds that are currently free

Regions

The regions endpoint can be found at the following url:
/api/regions/ will return a list of regions in the systems with the following fields.

  • id (integer): The id of the region
  • name (string): The name of the region
  • path (string): The slug of the region or identifiable name used in the url (used for inserting wherever <region_slug>) is asked in the api
  • administrative_division (string): the administrative division of the current region (for example City)
  • postal_code (string): The postal code
  • longitude (float): The longitude geo coordinate of the rough center of the region
  • langitude (float): The langitude geo coordinate of the rough center of the region

Languages

The languages endpoint can be found at the following url:
/api/<region_slug>/languages displays all languages of a region

  • id (integer): The id of the language
  • code (string): The language code in the format language-country (e.g. "de-de" or "en-us")
  • native_name (string): The language's native name
  • english_name (string): The name of the language in english
  • text_direction (string): The text direction, either "ltr" or "rtl"