Cities

Retrieving the available cities

Every city’s site exposes a list of cities configured in the system. However, if a city has decided to self-host the Gemini software, that particular city will not be returned in this endpoint, and vice versa, when connecting to that city’s install, it will not return all the other available cities.

import json
import os
import requests

# GEMINI_HOST should be something like: "https://<city>.makemusicday.org"
base_host = os.environ['GEMINI_HOST']

cities_url = f'{base_host}/api/cities'

resp = requests.get(cities_url)

print(json.dumps(resp.json(), indent=True, indent=4))

The response provided by the system will be variable in length, depending on how many cities are configured in this particular Gemini installation, but it should look something like this:

[
    {
        "_links": {
            "self": {
                "href": "/api/cities/nf",
                "method": "GET",
                "title": "Full city information."
            }
        },
        "accent_colour": "#da5616",
        "base_url": "https://nf.makemusicday.org",
        "contact_us_url": "http://makemusicday.org/western-ny",
        "country": "USA",
        "facebook_url": null,
        "font": null,
        "id": "88b9de68-f4de-46c0-b5cd-29d800d059be",
        "instagram_url": null,
        "latitude": 43.096214,
        "locale": "en_US",
        "logo_url": "https://da7jxvkvc73ty.cloudfront.net/wp-content/uploads/2016/02/NiagaraFalls-150x150.jpg",
        "longitude": -79.037739,
        "map_zoom_level": 10,
        "name": "Niagara Falls",
        "primary_button_colour": "#009faf",
        "secondary_button_colour": "#99b0b2",
        "slug": "nf",
        "terms": null,
        "timezone": "America/New_York",
        "twitter_url": null,
        "url": "http://makemusicday.org/western-ny",
        "youtube_url": null
    },
    {
        "_links": {
            "self": {
                "href": "/api/cities/nicholasville",
                "method": "GET",
                "title": "Full city information."
            }
        },
        "accent_colour": "#da5616",
        "base_url": "https://nicholasville.makemusicday.org",
        "contact_us_url": "http://www.makemusicday.org/nicholasville/",
        "country": "USA",
        "facebook_url": null,
        "font": null,
        "id": "8bd511bf-bd00-45f2-80c3-fa7131e74b7d",
        "instagram_url": null,
        "latitude": 37.880371,
        "locale": "en_US",
        "logo_url": "https://da7jxvkvc73ty.cloudfront.net/wp-content/uploads/2018/04/nicholasville-150x150.jpg",
        "longitude": -84.573021,
        "map_zoom_level": null,
        "name": "Nicholasville",
        "primary_button_colour": "#009faf",
        "secondary_button_colour": "#99b0b2",
        "slug": "nicholasville",
        "terms": null,
        "timezone": "America/New_York",
        "twitter_url": null,
        "url": "http://www.makemusicday.org/nicholasville/",
        "youtube_url": null
    }
]

As you can see, there are 2 cities, with a base amount of information about each. You should note that the base_url key contains the hostname to use when interacting with each city. The various other keys returned are somewhat self-explanatory.

Retrieving information about the current host

Continuing on the previous example, if you have a hostname, but don’t know what city it is serving data for, this can be obtained easily in a format similar to the previous example:

import json
import os
import requests

base_host = 'https://nf.makemusicday.org'

city_info_url = f'{base_host}/api/city/current'

resp = requests.get(city_info_url)

print(json.dumps(resp.json(), indent=True, indent=4))

The response should look something like this:

{
    "_links": {
        "self": {
            "href": "/api/cities/nf",
            "method": "GET",
            "title": "Full city information."
        }
    },
    "accent_colour": "#da5616",
    "base_url": "https://nf.makemusicday.org",
    "contact_us_url": "http://makemusicday.org/western-ny",
    "country": "USA",
    "facebook_url": null,
    "festival": {
        "is_launched": true,
    },
    "font": null,
    "id": "88b9de68-f4de-46c0-b5cd-29d800d059be",
    "instagram_url": null,
    "is_active": true,
    "is_paused": false,
    "latitude": 43.096214,
    "locale": "en_US",
    "logo_url": "https://da7jxvkvc73ty.cloudfront.net/wp-content/uploads/2016/02/NiagaraFalls-150x150.jpg",
    "longitude": -79.037739,
    "map_zoom_level": 10,
    "name": "Niagara Falls",
    "primary_button_colour": "#009faf",
    "secondary_button_colour": "#99b0b2",
    "slug": "nf",
    "terms": null,
    "timezone": "America/New_York",
    "twitter_url": null,
    "url": "http://makemusicday.org/western-ny",
    "venue_default_ada": false,
    "venue_default_has_piano": false,
    "welcome_blurb": "Make Music Day is a celebration of music on the summer solstice that is performed by anyone and enjoyed by everyone. You're invited to take part in the festivities and help show off our local talent and join the public celebration.\n\nThe festival is on June 21st and goes all day. It takes place in over 1,000 cities around the world.",
    "youtube_url": null
}

Available Festivals

It is possible that the current city has had mutliple festivals, and occasionally, we’d like to review past events. The following endpoint allows retrieval of the various historical festivals:

import json
import os
import requests

base_host = 'https://nf.makemusicday.org'

city_info_url = f'{base_host}/api/city/current/festivals'

resp = requests.get(city_info_url)

print(json.dumps(resp.json(), indent=True, indent=4))
{
    "current": null,
    "past": [
        {
            "end_time": "2021-06-21T21:00:00",
            "id": "b1b65984-69e4-4412-9eca-8a3b33b3a319",
            "start_time": "2021-06-21T08:00:00"
        },
        {
            "end_time": "2022-06-21T21:00:00",
            "id": "63684c23-bf3b-442b-94c4-2b20cdf0c682",
            "start_time": "2022-06-21T08:00:00"
        }
    ]
}