Microsoft Fabric

Modified on Wed, 15 Jul at 4:14 PM

This guide shows how to pull ILAP Analytics scheduling data — activities and periodized progress — into a Microsoft Fabric Lakehouse for reporting. It covers two patterns for getting the data in: a Python notebook that bulk-extracts via the export API, and a Dataflow Gen2 that refreshes the same data on a schedule using low-code Power Query. It is for planners and Power BI / report developers building reporting in Microsoft Fabric, and assumes familiarity with Fabric workspaces and Lakehouses, with either Python notebooks or Power Query depending on which pattern you choose, and that you can obtain a DataReader bearer token — see the Authentication guide for how to get one.

Which pattern to use

  • Notebook — code-based, flexible, and well suited to large bulk extracts.
  • Dataflow Gen2 — low-code Power Query, well suited to a scheduled refresh into a Lakehouse or Warehouse.

Pattern A — Notebook (bulk extract to a Lakehouse table)

Structure-verified — run with your DataReader token; the export endpoints are gzip-compressed and paginated.

import requests, pandas as pd

BASE  = "https://app-ilapanalytics-api-dev.azurewebsites.net"   # your environment
TOKEN = "<DataReader bearer token>"                              # see Authentication guide
HEADERS = {"Authorization": f"bearer {TOKEN}"}
REPORT_SCHEDULE_ID = "<report schedule id>"
REVISION = "Live"   # Live | Baseline | OriginalBaseline | Current

def export_all(resource, page_size=1000):
    """Page through a /api/v3/export collection. Each response is an
    OffsetPaginationResult record (PascalCase): {"Data": [...], "PageNumber",
    "PageSize", "TotalItems", "TotalPages"}. requests transparently gunzips."""
    rows, page = [], 1
    while True:
        params = {"ReportScheduleId": REPORT_SCHEDULE_ID, "RevisionType": REVISION,
                  "PageNumber": page, "PageSize": page_size}
        r = requests.get(f"{BASE}/api/v3/export/{resource}", headers=HEADERS,
                         params=params, timeout=180)
        r.raise_for_status()
        payload = r.json()
        rows.extend(payload["Data"])
        if page >= payload["TotalPages"]:   # last page
            break
        page += 1
    return rows

activities   = export_all("Activities")
periodized   = export_all("PeriodizedActivities")

df_activities = pd.DataFrame(activities)
spark.createDataFrame(df_activities).write.mode("overwrite").saveAsTable("ilap_activities")
spark.createDataFrame(pd.DataFrame(periodized)).write.mode("overwrite").saveAsTable("ilap_periodized")

Once this has run, report on the ilap_activities / ilap_periodized Lakehouse tables from Power BI (Direct Lake or import).

Pattern B — Dataflow Gen2 (low-code, scheduled refresh)

  1. In your Fabric workspace, New → Dataflow Gen2.
  2. Get data → Blank query.
  3. Paste the M below.
  4. Set the query's Data destination to a Lakehouse table.
  5. Publish and set a refresh schedule.
let
  BaseUrl = "https://app-ilapanalytics-api-dev.azurewebsites.net",
  Token = "<DataReader bearer token>",
  ReportScheduleId = "<report schedule id>",
  PageSize = 1000,
  // Each response is an OffsetPaginationResult record: [Data], [PageNumber], [PageSize], [TotalItems], [TotalPages]
  GetPage = (page as number) as record =>
    Json.Document(Web.Contents(BaseUrl & "/api/v3/export/Activities", [
      Query = [ ReportScheduleId = ReportScheduleId, RevisionType = "Live",
                PageNumber = Text.From(page), PageSize = Text.From(PageSize) ],
      Headers = [ Authorization = "bearer " & Token ] ])),
  FirstPage = GetPage(1),
  TotalPages = FirstPage[TotalPages],
  AllRows = List.Combine(
      { FirstPage[Data] } & List.Transform({2..TotalPages}, each GetPage(_)[Data]) ),
  Table = Table.FromRecords(AllRows)
in
  Table

See also

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article