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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.