{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Folio data API\n", "\n", "Read-only access to the deals Folio serves, over the versioned `/v1` API. Open demo: no key, no writes, no model calls.\n", "The schema is at `https://folio.waafir.io/api/v1/openapi.json`." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import requests\n", "\n", "BASE = \"https://folio.waafir.io/api/v1\"\n", "\n", "# Every deal Folio serves, one row each.\n", "deals = requests.get(f\"{BASE}/deals\").json()\n", "deal_id = \"green-lion-2024-1\"\n", "print(len(deals), \"deals;\", [d[\"name\"] for d in deals if d[\"id\"] == deal_id])\n", "\n", "# The reconstructed waterfall for the deal's latest period.\n", "waterfall = requests.get(f\"{BASE}/deals/{deal_id}/waterfall\").json()\n", "print(waterfall[\"reporting_period\"], waterfall[\"total_distributed\"])\n", "\n", "# The deal's tests and triggers.\n", "compliance = requests.get(f\"{BASE}/deals/{deal_id}/compliance\").json()\n", "print(compliance[\"summary\"])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Each route is documented in the schema by its `operationId`: `list_deals`, `get_deal_model`, `get_deal_waterfall`, `get_deal_compliance`, `get_deal_validation`, `get_deal_report_gate`, `get_deal_reported_items`, `get_deal_report_verification`." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model = requests.get(f\"{BASE}/deals/{deal_id}/model\").json()\n", "print(list(model)[:8])" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 5 }