Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Falcon
Helper I
Helper I

Oauth2 API with required multiple date parameters

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

1 REPLY 1
lbendlin
Super User
Super User

Follow the documentation of the API you are querying?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.