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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
DamianMcc
Frequent Visitor

Loop API call to obtain results based on single param change (from a list)

I am calling the ClickUp API to collect time sheet data from the "time_entries" endpoint. I can call the API for an individual user based on their user ID, this is passed in the URL paramiter.

 

I have created a list in PowerBI of all my users with their ID's called ClickUpAllUsers.

 

PBIDesktop_uSsFZJwjlW.png

I've also created a function which I can enter the ClickUpId to as  parameter.

 

(Assignee as text)=>
let
Source = Json.Document(Web.Contents("https://api.clickup.com/api/v2/team/<teamid>/time_entries?include_location_names=true&include_task_tags=true&start_date=1640997106&assignee="&Assignee, [Headers=[Authorization="<authcode>"]]))
in
Source

 This also works ok manually entering the ID.

 

I know I need to create a new blank query which loops through the userlist and calls the function to create a set of new lists, but I cannot figure out who to loop through the list of IDs and pass them to the Assignee param.

 

Can anyone assist?

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @DamianMcc ;

When you add a custom column (Invoke Custom Function), change the drop down to Column Name and select the app_id column.  Then, the function will pass in the app_id value from each row into the function (into the URL) and perform the query steps you designed earlier.  If you need to pass a bearer token to the URL for each app_id value, if it is the same bearer token for every app_id, you can add an Authorization header to the URL request.

Loop through list a to perform a REST API call and... - Microsoft Power BI Community

How to loop through an API with Power BI without knowing last page – PBI Guy (pbi-guy.com)

Use Power BI to loop through multiple pages of an API - YouTube


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

DamianMcc
Frequent Visitor

I may have solved it with the help of exploring related articles.

 

Is this the best way?

 

 

 

let
    Source = ClickUpAllUsers,
    AddColumn =
        Table.AddColumn(
            Source,
            "Custom",
            each FxClickUpTimev2([ClickupId])
        )
in
    AddColumn

 



 

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors