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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
jshirley
Frequent Visitor

Need help adjusting some code to equate for the limits set on by the website api I am using

Hello all,

 I still new to PowerBi and I am trying to figure out how to apply an offset to my code that will allow my query to pull all the records instead just what the limit is. 

Here is my code:

= (offset) =>
let
limit = 500,
Source = Json.Document(
Web.Contents("https://www.leaflink.com/api/v2/orders-received/?limit=500",
[
RelativePath="tables/orders-received?top=500&skip="
& Number.ToText(offset*limit) & "&select=number,short_id,external_id_seller,external_id_buyer,ext_acct_id,created_on,user,buyer,seller,customer,brand,status,manual,discount,discount_type,tax_amount,tax_type,final_tax,shipping_charge,total,payment_term,payment_methods,selected_payment_option,payment_due_date,paid,paid_date,ship_date,shipping_details,notes,internal_notes,delivery_preferences,sales_reps,classification,payment_balance,available_transitions,modified,has_special_requests,delivery_provider,order_taxes,delivery_info,is_combination,llf_payment_method,credits,facility_id,order_number,order_seller_number,order_buyer_number,order_short_number,distributor,external_ids,corporate_address,delivery_address",
Headers=[Authorization= "App API_KEY"]]))
in
Source

3 REPLIES 3
jshirley
Frequent Visitor

@ppm1 That solution doesn't work for me. I had to connect to my api via a blank querry which won't let me add a custom function in like he suggests. 

Not sure what you mean about your API needing a blank query. Why aren't you able to make a list of numbers and then concatenate that into a web call on each row?

 

Pat

Microsoft Employee
ppm1
Solution Sage
Solution Sage

Please see this video for an example.

Power BI - Tales From The Front - REST APIs - YouTube

 

Pat

Microsoft Employee

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors