Hi Can I ask for help in changing the query below to make it work for schedule refresh? I've been going around in the community and web but really can't find a fix for my problem. Thank you so much!
let
baseuri = "https://app.asana.com/api/1.0/projects?limit=100&workspace=*****************&opt_fields=team,name,owner,current_status,due_on,start_on,created_at,modified_at,public,members,custom_fields,custom_field_settings,color,notes,html_notes,workspace,archived",
headers = [Headers=[#"Content-Type"="application/json", Authorization="Bearer 1/**************************"]],
initReq = Json.Document(Web.Contents("https://app.asana.com/api/1.0/projects?limit=100&workspace=*****************&opt_fields=team,name,owner,current_status,due_on,start_on,created_at,modified_at,public,members,custom_fields,custom_field_settings,color,notes,html_notes,workspace,archived", headers)),
initData = initReq[data],
gather = (data as list, uri) =>
let
newOffset = Json.Document(Web.Contents(uri, headers))[next_page][offset],
newUri = baseuri & "&offset=" & newOffset,
newReq = Json.Document(Web.Contents(newUri, headers)),
newdata = newReq[data],
data = List.Combine({data, newdata}),
check = if newReq[next_page] = null then data else @gather(data, newUri)
in check,
outputList = if initReq[next_page] = null then initData else gather(initData, baseuri),
expand = Table.FromRecords(outputList),
#"Changed Type" = Table.TransformColumnTypes(expand,{{"created_at", type datetime}, {"modified_at", type datetime}, {"due_on", type date}, {"start_on", type date}}),
#"Expanded team" = Table.ExpandRecordColumn(#"Changed Type", "team", {"gid"}, {"team.gid"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded team",{ "workspace"}),
#"Expanded owner" = Table.ExpandRecordColumn(#"Removed Columns", "owner", {"gid"}, {"owner.gid"}),
#"Removed Columns1" = Table.RemoveColumns(#"Expanded owner",{"current_status", "custom_fields", "custom_field_settings", "members", "html_notes", "color"}),
#"Reordered Columns" = Table.ReorderColumns(#"Removed Columns1",{"gid", "created_at", "modified_at", "start_on", "due_on", "name", "notes", "owner.gid", "team.gid"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Reordered Columns",{{"archived", type text}, {"public", type text}}),
#"Replaced Value" = Table.ReplaceValue(#"Changed Type1","true","Yes",Replacer.ReplaceText,{"archived", "public"}),
#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value","false","No",Replacer.ReplaceText,{"archived", "public"})
in
#"Replaced Value1"
Hey @krixtsup3r, did you manage to solve this? I am having the exact same issue!
Hi @krixtsup3r
In your gather function, below codes would create dynamic url. Maybe this is the cause.
newOffset = Json.Document(Web.Contents(uri, headers))[next_page][offset],
newUri = baseuri & "&offset=" & newOffset,
You could refer to Chris Webb's BI Blog: Web.Contents(), M Functions And Dataset Refresh Errors In Power BI
(as well as other links in this blog directing to his previous blogs). Try using RelativePath and Query options with Web.Contents() to query data. Use a valid static URL as a base URL and put dynamic part in RelativePath or Query options.
Hope this would be helpful.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
@krixtsup3r check these posts
Power BI: Gateway Monitoring & Administrating- Par... - Microsoft Power BI Community
Solved: Refreshing data from REST API works on Desktop, fa... - Microsoft Power BI Community
✨ Follow us on LinkedIn
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Not sure why but the gateway option is not showing on my end.
@krixtsup3r you need a gateway to make it work. Power BI Gateway | Microsoft Power BI
✨ Follow us on LinkedIn
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi, I have a gateway. Not sure what you meant is there any set up that I need to do?
Are you getting a Formula.Firewall warning? What's the error message?
Hi Im getting the following errors:
if in service:
if in desktop:
Set the privacy settings for the report to Ignore if that is acceptable.
It's already in ignore mode.