Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Help on using search_after using a value such as report_number

Hi I am looking to pull in API results from the openFDA    An example API call would be api.fda.gov/device/event.json?search=date_received:[20250101+TO+20250201] lets say   I am trying to find ho...
  • v-menakakota's avatar
    v-menakakota
    1 year ago

    Hi Anonymous ,

    You're correct in your understanding: to retrieve all results from OpenFDA’s API, you would need to implement pagination using the search_after parameter, based on the last MDR_REPORT_KEY (or safetyreportid) from each page. Power Query can support this approach, but it typically requires defining a custom function and looping logic to continue fetching data until there are no further results.

    However, since this API is external and we’re unable to reproduce or validate its behavior from our side, we're limited in providing a complete tested implementation specific to this endpoint. That said, this is a common pattern in Power Query, and many community-driven solutions exist to paginate using search_after by dynamically updating query parameters.

    As a next step, I recommend either:

    • Engaging a Power BI developer or internal technical resource who can help implement this pattern, or
    • Referring to community samples around OpenFDA + Power Query pagination these often provide reusable templates with minimal adjustments.

    If you're looking for learning resources or generic pagination patterns using

    List.Generate - PowerQuery M | Microsoft Learn


    If this post was helpful, please give us Kudos and consider marking Accept as solution to assist other members in finding it more easily.
    Thank you,
    Menaka.