> For the complete documentation index, see [llms.txt](https://bloombus.gitbook.io/bloombus/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bloombus.gitbook.io/bloombus/bloombus-server/rest-api.md).

# REST API

## Download Stops GeoJSON

<mark style="color:blue;">`GET`</mark> `https://bloombus.bloomu.edu/api/download/stops/geojson`

Retrieves the current state of the GeoJSON representing the geometry of shuttle stops from the Firebase Realtime Database. Since it is not stored in Firebase as proper GeoJSON (features residing within a FeatureCollection) the data is massaged within this service before it is sent to the client.

{% tabs %}
{% tab title="200 Stops GeoJSON successfully retrieved." %}
{% code title="stops-2019-05-26.geojson" %}

```javascript
{
  "type": "FeatureCollection",
  "features": [
    {
      "geometry": {
        "coordinates": [
          -76.449313,
          41.00196
        ],
        "type": "Point"
      },
      "properties": {
        "name": "Corner East/5th",
        "stopKey": "cornerEast5th"
      },
      "type": "Feature"
    },
    ...
  ]
}
```

{% endcode %}
{% endtab %}

{% tab title="404 " %}

```javascript
{
    "message": "Error retrieving stops GeoJSON."
}
```

{% endtab %}
{% endtabs %}

## Download Loops GeoJSON

<mark style="color:blue;">`GET`</mark> `https://bloombus.bloomu.edu/api/download/loops/geojson`

Retrieves the current state of the GeoJSON representing the geometry of shuttle loops from the Firebase Realtime Database.

{% tabs %}
{% tab title="200 Loops GeoJSON successfully retrieved." %}
{% code title="loops-2019-05-26.geojson" %}

```
{
  "crs": {
    "properties": {
      "name": "EPSG:4326"
    },
    "type": "name"
  },
  "features": [
    {
      "geometry": {
        "coordinates": [
          [
            -76.44382211899995,
            41.01081362700006
          ],
          [
            -76.44447165999998,
            41.01080468400005
          ],
          [
            -76.44444118899997,
            41.00983172800005
          ],
          ...
        ],
        "type": "LineString"
      },
      "id": 1,
      "properties": {
        "color": "#33A3F4",
        "key": "campus",
        "name": "Campus Loop",
        "objectID": 1,
        "shapeLength": 0.03144377168231157,
        "stops": [
          "library",
          "nelsonFieldHouse",
          "jka",
          "orangeLot",
          "moa",
          "mpa"
        ]
      },
      "type": "Feature"
    },
    ...
  ],
  "type": "FeatureCollection"
}

```

{% endcode %}
{% endtab %}
{% endtabs %}

## Upload Stops GeoJSON

<mark style="color:green;">`POST`</mark> `https://bloombus.bloomu.edu/api/upload/stops/geojson`

Parses GeoJSON representing the geometry of shuttle stops and updates the `/stops` reference in the Firebase Realtime Database with this GeoJSON. Since the GeoJSON is meant to be stored in the Firebase Realtime Database under the `/stops` reference as key-value pairs of each stop's key string to a GeoJSON Feature object, the previously valid GeoJSON provided in the uploaded file will be massaged into this format.

#### Headers

| Name         | Type   | Description         |
| ------------ | ------ | ------------------- |
| Content-Type | string | multipart/form-data |

#### Request Body

| Name          | Type   | Description                                                |
| ------------- | ------ | ---------------------------------------------------------- |
| stops-geojson | object | The File object provided by an HTML `<input type="file/>`. |

{% tabs %}
{% tab title="200 Successfully updated stops GeoJSON." %}

```
```

{% endtab %}
{% endtabs %}

## Upload Loops GeoJSON

<mark style="color:green;">`POST`</mark> `https://bloombus.bloomu.edu/api/upload/loops/geojson`

Parses GeoJSON representing the geometry of shuttle loops and updates the `/loops` reference in the Firebase Realtime Database with this GeoJSON.

#### Path Parameters

| Name         | Type   | Description         |
| ------------ | ------ | ------------------- |
| Content-Type | string | multipart/form-data |

#### Request Body

| Name          | Type   | Description                                                |
| ------------- | ------ | ---------------------------------------------------------- |
| loops-geojson | object | The File object provided by an HTML `<input type="file/>`. |

{% tabs %}
{% tab title="200 Successfully updated loops GeoJSON." %}

```
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bloombus.gitbook.io/bloombus/bloombus-server/rest-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
