Forum Discussion
API request using FunctionIInvokeAfter - stop delays once all the data is loaded
- Anonymous2 years ago
Hi pmershon ,
Based on your description and the code provided, since each API call is very time-consuming, please minimize the number of calls by batching requests whenever possible. Although the CrossRef API does not support multiple queries in a single request, you can still optimize by reducing unnecessary steps in your queries.
You can try creating a custom functionlet fxGetCrossRefDOI = (Title) => let baseURL = "https://api.crossref.org/works", query = Uri.EscapeDataString(Title), URL = baseURL & "?rows=1&sort=relevance&query.bibliographic=" & query & "&select=title,container-title,DOI,ISSN&filter=type:journal-article", response = Json.Document(Web.Contents(URL)) in response in fxGetCrossRefDOIOf course, you can also use Table.Buffer, which helps to minimize the number of times you have to read data from the source. You can use load data into memory, which may speed up subsequent steps
Table.Buffer - PowerQuery M | Microsoft Learn
You can also refer to this document to learn how to use the Rest API
TripPin 2 - REST - Power Query | Microsoft LearnBest regards,
Albert HeIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi pmershon ,
Based on your description and the code provided, since each API call is very time-consuming, please minimize the number of calls by batching requests whenever possible. Although the CrossRef API does not support multiple queries in a single request, you can still optimize by reducing unnecessary steps in your queries.
You can try creating a custom function
let
fxGetCrossRefDOI = (Title) =>
let
baseURL = "https://api.crossref.org/works",
query = Uri.EscapeDataString(Title),
URL = baseURL & "?rows=1&sort=relevance&query.bibliographic=" & query & "&select=title,container-title,DOI,ISSN&filter=type:journal-article",
response = Json.Document(Web.Contents(URL))
in
response
in
fxGetCrossRefDOI
Of course, you can also use Table.Buffer, which helps to minimize the number of times you have to read data from the source. You can use load data into memory, which may speed up subsequent steps
Table.Buffer - PowerQuery M | Microsoft Learn
You can also refer to this document to learn how to use the Rest API
TripPin 2 - REST - Power Query | Microsoft Learn
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly