Back to All

Power Bi API - Idling

Hi I am trying to get my API connector to work in power query but am getting 400 errors for the following:

let parameters = (after as any,limit as any,startMs as text,endMs as text, vehicleIds as any,tagIds as any,parentTagIds as any,isPtoActive as any,minIdlingDurationMinutes as any) =>
let
accessToken = "'API Token Here'",
baseUrl = "https://api.samsara.com",
endpointUrl = "/fleet/reports/vehicle/idling",
initialRequest = Json.Document(Web.Contents(baseUrl,[RelativePath = endpointUrl & "?after=" & after & "&limit=" & limit & "&startMs=" & startMs & "&endMs=" & endMs & "&vehicleIds=" & vehicleIds & "&tagIds=" & tagIds & "&parentTagIds=" & parentTagIds & "&isPtoActive=" & isPtoActive & "&minIdlingDurationMinutes=" & minIdlingDurationMinutes, Headers = [Authorization = "Bearer " & accessToken]]))
in
initialRequest
in
parameters

I have gotten some simpler APIs to work, but these parameters are throwing me for a loop. What am I doing wrong here?


Thank you!