let
// first call to get access token
	// enter your integration key here
	SecretKey = "YOUR_INTEGRATION_KEY",
	
	// makes call to get access token
    Source = Json.Document(Web.Contents(" https://cloud.hawkindynamics.com/api/token", [Headers=[Authorization="Bearer " & SecretKey]])),
    ResponseTable = Table.FromRecords({Source}),
    NewTable = Table.TransformColumnTypes(ResponseTable,{{"access_token", type text}, {"token_type", type text}, {"expires_at", Int64.Type}}),
    
	// extract access token from response table
    tokenList = NewTable[access_token],
    accessToken = Text.From(tokenList{0}),

// Create variable for test type
    testType = "pqgf2TPUOQOQs6r0HQWb",

// second call for CMJ Rebound data
    Source2 = Json.Document(Web.Contents("https://cloud.hawkindynamics.com/api/dev?" & "testTypeId=" & testType, [Headers=[Authorization="Bearer " & accessToken]])),
    responseTable = Table.FromRecords({Source2}),

    // expand table from responce
    expandTable = Table.ExpandListColumn(responseTable, "data"),

    // expand data columns
    expandData = Table.ExpandRecordColumn(expandTable, "data", {"id", "timestamp", "segment", "testType", "athlete", "CMJ Peak Propulsive Force(N)", "Impulse Ratio", "CMJ Propulsive Impulse(N.s)", "Left CMJ Avg. Propulsive Force(N)", "CMJ Relative Force At Min Displacement(%)", "CMJ L|R Propulsive Impulse Index(%)", "CMJ Force At Min Displacement(N)", "CMJ Avg. Relative Braking Force(%)", "Rebound Force At Min Displacement(N)", "Rebound Jump Height(m)", "CMJ Modified RSI", "CMJ Braking Net Impulse(N.s)", "Rebound L|R Avg. Braking Force(%)", "Rebound Avg. Relative Braking Power(W/kg)", "CMJ Braking Impulse(N.s)", "Rebound L|R Propulsive Impulse Index(%)", "CMJ Avg. Relative Propulsive Power(W/kg)", "Rebound Relative Braking Impulse(N.s/kg)", "CMJ Peak Relative Propulsive Force(%)", "CMJ L|R Avg. Propulsive Force(%)", "Right Rebound Avg. Propulsive Force(N)", "Rebound Relative Braking Net Impulse(N.s/kg)", "Left Avg. Landing Force(N)", "Rebound Positive Net Impulse(N.s)", "Right CMJ Avg. Braking Force(N)", "CMJ Avg. Braking Force(N)", "CMJ L|R Braking Impulse Index(%)", "Rebound Contact Time(ms)", "Right Rebound Avg. Braking Force(N)", "Rebound Spring Like Correlation", "Rebound Peak Braking Force(N)", "Peak Landing Force(N)", "Rebound Avg. Relative Braking Force(%)", "Rebound Jump Momentum(kg.m/s)", "CMJ Relative Propulsive Impulse(N.s/kg)", "Rebound Avg. Relative Propulsive Force(%)", "Rebound Propulsive Impulse(N.s)", "Rebound Avg. Propulsive Power(W)", "Left Rebound Avg. Propulsive Force(N)", "Right Avg. Landing Force(N)", "Rebound Flight Time(ms)", "Rebound Peak Relative Braking Force(%)", "CMJ Avg. Propulsive Force(N)", "CMJ Peak Relative Braking Force(%)", "Left Rebound Avg. Braking Force(N)", "Rebound RSI", "CMJ Avg. Relative Braking Power(W/kg)", "Rebound Propulsive Net Impulse(N.s)", "Rebound Relative Propulsive Net Impulse(N.s/kg)", "CMJ Time To Takeoff(s)", "Rebound Avg. Propulsive Force(N)", "CMJ Peak Braking Force(N)", "Rebound Peak Relative Propulsive Power(W/kg)", "CMJ Peak Relative Propulsive Power(W/kg)", "CMJ Peak Braking Power(W)", "Rebound Relative Force At Min Displacement(%)", "Rebound Depth(m)", "Time to Stabilization(ms)", "CMJ Avg. Propulsive Power(W)", "Rebound Peak Propulsive Force(N)", "Rebound Avg. Braking Force(N)", "Positive Impulse(N.s)", "Relative Peak Landing Force(%)", "CMJ Avg. Relative Propulsive Force(%)", "Rebound Time to Peak Braking Force(ms)", "Right CMJ Avg. Propulsive Force(N)", "CMJ Braking RFD(N/s)", "System Weight(N)", "Left CMJ Avg. Braking Force(N)", "Rebound Peak Braking Power(W)", "L|R Avg. Landing Force(%)", "Rebound Peak Relative Propulsive Force(%)", "Landing Stiffness(N/m)", "Rebound Braking Impulse(N.s)", "CMJ Propulsive Net Impulse(N.s)", "CMJ Jump Momentum(kg.m/s)", "CMJ Peak Relative Braking Power(W/kg)", "CMJ L|R Avg. Braking Force(%)", "Rebound Impulse Ratio", "Rebound Stiffness(N/m)", "CMJ Relative Braking Net Impulse(N.s/kg)", "Rebound Avg. Braking Power(W)", "Rebound Relative Propulsive Impulse(N.s/kg)", "CMJ RSI", "CMJ Avg. Braking Power(W)", "Right Force at Peak Landing Force(N)", "CMJ Peak Propulsive Power(W)", "Rebound L|R Avg. Propulsive Force(%)", "Rebound Peak Propulsive Power(W)", "L|R Peak Landing Force(%)", "Avg. Landing Force(N)", "Rebound Peak Relative Braking Power(W/kg)", "CMJ Relative Propulsive Net Impulse(N.s/kg)", "Rebound Impact Peak(Yes/No)", "Rebound L|R Braking Impulse Index(%)", "CMJ Jump Height(m)", "Rebound Positive Impulse(N.s)", "Left Force at Peak Landing Force(N)", "L|R Landing Impulse Index(%)", "Rebound Modified RSI", "CMJ Relative Braking Impulse(N.s/kg)", "Positive Net Impulse(N.s)", "CMJ Depth(m)", "Rebound Braking Net Impulse(N.s)", "active"}, {"id", "timestamp", "segment", "testType", "athlete", "CMJ Peak Propulsive Force(N)", "Impulse Ratio", "CMJ Propulsive Impulse(N.s)", "Left CMJ Avg. Propulsive Force(N)", "CMJ Relative Force At Min Displacement(%)", "CMJ L|R Propulsive Impulse Index(%)", "CMJ Force At Min Displacement(N)", "CMJ Avg. Relative Braking Force(%)", "Rebound Force At Min Displacement(N)", "Rebound Jump Height(m)", "CMJ Modified RSI", "CMJ Braking Net Impulse(N.s)", "Rebound L|R Avg. Braking Force(%)", "Rebound Avg. Relative Braking Power(W/kg)", "CMJ Braking Impulse(N.s)", "Rebound L|R Propulsive Impulse Index(%)", "CMJ Avg. Relative Propulsive Power(W/kg)", "Rebound Relative Braking Impulse(N.s/kg)", "CMJ Peak Relative Propulsive Force(%)", "CMJ L|R Avg. Propulsive Force(%)", "Right Rebound Avg. Propulsive Force(N)", "Rebound Relative Braking Net Impulse(N.s/kg)", "Left Avg. Landing Force(N)", "Rebound Positive Net Impulse(N.s)", "Right CMJ Avg. Braking Force(N)", "CMJ Avg. Braking Force(N)", "CMJ L|R Braking Impulse Index(%)", "Rebound Contact Time(ms)", "Right Rebound Avg. Braking Force(N)", "Rebound Spring Like Correlation", "Rebound Peak Braking Force(N)", "Peak Landing Force(N)", "Rebound Avg. Relative Braking Force(%)", "Rebound Jump Momentum(kg.m/s)", "CMJ Relative Propulsive Impulse(N.s/kg)", "Rebound Avg. Relative Propulsive Force(%)", "Rebound Propulsive Impulse(N.s)", "Rebound Avg. Propulsive Power(W)", "Left Rebound Avg. Propulsive Force(N)", "Right Avg. Landing Force(N)", "Rebound Flight Time(ms)", "Rebound Peak Relative Braking Force(%)", "CMJ Avg. Propulsive Force(N)", "CMJ Peak Relative Braking Force(%)", "Left Rebound Avg. Braking Force(N)", "Rebound RSI", "CMJ Avg. Relative Braking Power(W/kg)", "Rebound Propulsive Net Impulse(N.s)", "Rebound Relative Propulsive Net Impulse(N.s/kg)", "CMJ Time To Takeoff(s)", "Rebound Avg. Propulsive Force(N)", "CMJ Peak Braking Force(N)", "Rebound Peak Relative Propulsive Power(W/kg)", "CMJ Peak Relative Propulsive Power(W/kg)", "CMJ Peak Braking Power(W)", "Rebound Relative Force At Min Displacement(%)", "Rebound Depth(m)", "Time to Stabilization(ms)", "CMJ Avg. Propulsive Power(W)", "Rebound Peak Propulsive Force(N)", "Rebound Avg. Braking Force(N)", "Positive Impulse(N.s)", "Relative Peak Landing Force(%)", "CMJ Avg. Relative Propulsive Force(%)", "Rebound Time to Peak Braking Force(ms)", "Right CMJ Avg. Propulsive Force(N)", "CMJ Braking RFD(N/s)", "System Weight(N)", "Left CMJ Avg. Braking Force(N)", "Rebound Peak Braking Power(W)", "L|R Avg. Landing Force(%)", "Rebound Peak Relative Propulsive Force(%)", "Landing Stiffness(N/m)", "Rebound Braking Impulse(N.s)", "CMJ Propulsive Net Impulse(N.s)", "CMJ Jump Momentum(kg.m/s)", "CMJ Peak Relative Braking Power(W/kg)", "CMJ L|R Avg. Braking Force(%)", "Rebound Impulse Ratio", "Rebound Stiffness(N/m)", "CMJ Relative Braking Net Impulse(N.s/kg)", "Rebound Avg. Braking Power(W)", "Rebound Relative Propulsive Impulse(N.s/kg)", "CMJ RSI", "CMJ Avg. Braking Power(W)", "Right Force at Peak Landing Force(N)", "CMJ Peak Propulsive Power(W)", "Rebound L|R Avg. Propulsive Force(%)", "Rebound Peak Propulsive Power(W)", "L|R Peak Landing Force(%)", "Avg. Landing Force(N)", "Rebound Peak Relative Braking Power(W/kg)", "CMJ Relative Propulsive Net Impulse(N.s/kg)", "Rebound Impact Peak(Yes/No)", "Rebound L|R Braking Impulse Index(%)", "CMJ Jump Height(m)", "Rebound Positive Impulse(N.s)", "Left Force at Peak Landing Force(N)", "L|R Landing Impulse Index(%)", "Rebound Modified RSI", "CMJ Relative Braking Impulse(N.s/kg)", "Positive Net Impulse(N.s)", "CMJ Depth(m)", "Rebound Braking Net Impulse(N.s)", "active"}),
    // Expand test type data
    expandTestData = Table.ExpandRecordColumn(expandData, "testType", {"id", "name", "canonicalId"}, {"test.id", "test.name", "test.canonicalId"}),
    
    // Expand athlete data
    expandAthleteData = Table.ExpandRecordColumn(expandTestData, "athlete", {"id", "name", "active", "teams", "groups"}, {"athlete.id", "athlete.name", "athlete.active", "athlete.teams", "athlete.groups"}),
    
    // extract athlete teams
    extractTeams = Table.TransformColumns(expandAthleteData, {"athlete.teams", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
    
    // extract athlete groups
    extractGroups = Table.TransformColumns(extractTeams, {"athlete.groups", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
    
    // add date column
    addedDate = Table.AddColumn(extractGroups, "date", each DateTimeZone.ToLocal(DateTime.AddZone(#datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [timestamp]),0))),

    // chane column formats
    changeType = Table.TransformColumnTypes(addedDate,{{"timestamp", Int64.Type}, {"lastSyncTime", Int64.Type}, {"lastTestTime", Int64.Type}, {"count", Int64.Type}, {"date", type date}, {"id", type text}, {"segment", type text}, {"test.id", type text}, {"test.name", type text}, {"test.canonicalId", type text}, {"athlete.id", type text}, {"athlete.name", type text}, {"athlete.teams", type text}, {"athlete.groups", type text}, {"active", type logical}}),

    // reorder columns
    outputTable = Table.ReorderColumns(changeType,{"id", "active", "timestamp", "segment", "test.id", "test.name", "test.canonicalId", "athlete.id", "athlete.name", "athlete.active", "athlete.teams", "athlete.groups", "CMJ Peak Propulsive Force(N)", "Impulse Ratio", "CMJ Propulsive Impulse(N.s)", "Left CMJ Avg. Propulsive Force(N)", "CMJ Relative Force At Min Displacement(%)", "CMJ L|R Propulsive Impulse Index(%)", "CMJ Force At Min Displacement(N)", "CMJ Avg. Relative Braking Force(%)", "Rebound Force At Min Displacement(N)", "Rebound Jump Height(m)", "CMJ Modified RSI", "CMJ Braking Net Impulse(N.s)", "Rebound L|R Avg. Braking Force(%)", "Rebound Avg. Relative Braking Power(W/kg)", "CMJ Braking Impulse(N.s)", "Rebound L|R Propulsive Impulse Index(%)", "CMJ Avg. Relative Propulsive Power(W/kg)", "Rebound Relative Braking Impulse(N.s/kg)", "CMJ Peak Relative Propulsive Force(%)", "CMJ L|R Avg. Propulsive Force(%)", "Right Rebound Avg. Propulsive Force(N)", "Rebound Relative Braking Net Impulse(N.s/kg)", "Left Avg. Landing Force(N)", "Rebound Positive Net Impulse(N.s)", "Right CMJ Avg. Braking Force(N)", "CMJ Avg. Braking Force(N)", "CMJ L|R Braking Impulse Index(%)", "Rebound Contact Time(ms)", "Right Rebound Avg. Braking Force(N)", "Rebound Spring Like Correlation", "Rebound Peak Braking Force(N)", "Peak Landing Force(N)", "Rebound Avg. Relative Braking Force(%)", "Rebound Jump Momentum(kg.m/s)", "CMJ Relative Propulsive Impulse(N.s/kg)", "Rebound Avg. Relative Propulsive Force(%)", "Rebound Propulsive Impulse(N.s)", "Rebound Avg. Propulsive Power(W)", "Left Rebound Avg. Propulsive Force(N)", "Right Avg. Landing Force(N)", "Rebound Flight Time(ms)", "Rebound Peak Relative Braking Force(%)", "CMJ Avg. Propulsive Force(N)", "CMJ Peak Relative Braking Force(%)", "Left Rebound Avg. Braking Force(N)", "Rebound RSI", "CMJ Avg. Relative Braking Power(W/kg)", "Rebound Propulsive Net Impulse(N.s)", "Rebound Relative Propulsive Net Impulse(N.s/kg)", "CMJ Time To Takeoff(s)", "Rebound Avg. Propulsive Force(N)", "CMJ Peak Braking Force(N)", "Rebound Peak Relative Propulsive Power(W/kg)", "CMJ Peak Relative Propulsive Power(W/kg)", "CMJ Peak Braking Power(W)", "Rebound Relative Force At Min Displacement(%)", "Rebound Depth(m)", "Time to Stabilization(ms)", "CMJ Avg. Propulsive Power(W)", "Rebound Peak Propulsive Force(N)", "Rebound Avg. Braking Force(N)", "Positive Impulse(N.s)", "Relative Peak Landing Force(%)", "CMJ Avg. Relative Propulsive Force(%)", "Rebound Time to Peak Braking Force(ms)", "Right CMJ Avg. Propulsive Force(N)", "CMJ Braking RFD(N/s)", "System Weight(N)", "Left CMJ Avg. Braking Force(N)", "Rebound Peak Braking Power(W)", "L|R Avg. Landing Force(%)", "Rebound Peak Relative Propulsive Force(%)", "Landing Stiffness(N/m)", "Rebound Braking Impulse(N.s)", "CMJ Propulsive Net Impulse(N.s)", "CMJ Jump Momentum(kg.m/s)", "CMJ Peak Relative Braking Power(W/kg)", "CMJ L|R Avg. Braking Force(%)", "Rebound Impulse Ratio", "Rebound Stiffness(N/m)", "CMJ Relative Braking Net Impulse(N.s/kg)", "Rebound Avg. Braking Power(W)", "Rebound Relative Propulsive Impulse(N.s/kg)", "CMJ RSI", "CMJ Avg. Braking Power(W)", "Right Force at Peak Landing Force(N)", "CMJ Peak Propulsive Power(W)", "Rebound L|R Avg. Propulsive Force(%)", "Rebound Peak Propulsive Power(W)", "L|R Peak Landing Force(%)", "Avg. Landing Force(N)", "Rebound Peak Relative Braking Power(W/kg)", "CMJ Relative Propulsive Net Impulse(N.s/kg)", "Rebound Impact Peak(Yes/No)", "Rebound L|R Braking Impulse Index(%)", "CMJ Jump Height(m)", "Rebound Positive Impulse(N.s)", "Left Force at Peak Landing Force(N)", "L|R Landing Impulse Index(%)", "Rebound Modified RSI", "CMJ Relative Braking Impulse(N.s/kg)", "Positive Net Impulse(N.s)", "CMJ Depth(m)", "Rebound Braking Net Impulse(N.s)", "count", "lastSyncTime", "lastTestTime", "date"})
in
    outputTable