Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello,
Recently, I have been successful in pulling data using API calls with the following script
let
ClientId = "xxxxxxxx",
ClientSecret = "xxxxxxxxxxx",
Uri = "https://xxxxxxxxxxxxx",
dataURL = "https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
body ="{
""grant_type"": ""client_credentials"",
""client_id"": """ & ClientId & """,
""client_secret"": """ & ClientSecret & """
}",
getToken = Json.Document(
Web.Contents(
Uri,
[
RelativePath="xxxxxx/api/v2/oauth/token",
Headers = [#"Content-Type"="application/json"],
Content=Text.ToBinary(body)
]
)
),
token = getToken[token],
AuthHeaders = [Authorization = "Bearer " & token],
Response = Json.Document(Web.Contents(scheduleURL, [Headers = AuthHeaders])),
#"Converted to Table" = Table.FromList(Response, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"schedule_id", "name", "is_archived", "order", "positions"}, {"Column1.schedule_id", "Column1.name", "Column1.is_archived", "Column1.order", "Column1.positions"}),
#"Expanded Column1.positions" = Table.ExpandListColumn(#"Expanded Column1", "Column1.positions"),
#"Expanded Column1.positions1" = Table.ExpandRecordColumn(#"Expanded Column1.positions", "Column1.positions", {"position_id", "position_qualification_id", "label", "order"}, {"Column1.positions.position_id", "Column1.positions.position_qualification_id", "Column1.positions.label", "Column1.positions.order"}),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Column1.positions1",{{"Column1.schedule_id", Int64.Type}, {"Column1.name", type text}, {"Column1.is_archived", type logical}, {"Column1.order", Int64.Type}, {"Column1.positions.position_id", Int64.Type}, {"Column1.positions.position_qualification_id", Int64.Type}, {"Column1.positions.label", type text}, {"Column1.positions.order", Int64.Type}})
in
#"Changed Type"
It works. However, now I try to call different API (different table) with multiple date parameters required (startDate and endDate). Can someone help me with that? I really appreciate it. Thanks in advance
Follow the documentation of the API you are querying?
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 11 | |
| 6 | |
| 4 | |
| 4 | |
| 3 |