Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Hello,
I've been tasked with getting all time entries from Toggle into Power Bi. Problem: Only 50 records are returned. Does anyone have experience with this and know how to retrieve all records? Or is there another preferred method? Below is the query and a link to the API documentation.
Thank you,
Bob
API Doc: https://developers.track.toggl.com/docs/
let
baseUrl = "https://api.track.toggl.com/",
// the token part can vary depending on the requisites of the API
accessToken = "Basic Mzg2MzQ1NGFlZGU3Nzg3YWE5MzE0ZjU0ZGU4NmRkNjk6YXBpX3Rva2Vu",
postData = Json.FromValue([start_date = #date(2023,1,1)]),
options = [
Headers = [Authorization = accessToken, #"Content-Type" =
"application/json;"], RelativePath ="reports/api/v3/workspace/{workspace_id}/search/time_entries",
Content = postData
],
Source = Web.Contents(baseUrl, options),
// since Web.Contents() doesn't parse the binaries it fetches, you must use another
// function to see if the data was retreived, based on the datatype of the data
parsedData = Json.Document(Source)
in
parsedData
Looking at the Project page of that site shows at least that API method supports pagination.
Perhaps the Workspaces one does too. You can either try it with pagination and List.Generate, or create a list of ids to be used as a start id for the next 50 records, as described in this video.
Power BI - Tales From The Front - REST APIs - YouTube
Pat
Thank you for taking the time to respond. What I learned:
1) /pagination is not supported with Workspaces.
2) The video was very informative and I learned from viewing it, but I haven't found a way for the total number of records to be returned, so I'm not sure that creating a list of ids in a multiple of 50 would offer benefit.
Again, thank you for your time. My search continues.
Bob
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
62 | |
54 | |
27 | |
16 | |
13 |