Im currently working with the microsoft calendar api and im unable to page though the data

Options

When i make an api call to microsoft graph events, i get 10 results then a link that would enable me get another set of results but i dont have an idea how to utilize that link to get the next set of data

Answers

  • Lachlan
    Lachlan Administrator

    ADMIN

    Options

    Hey there,

    Are you able to share some more details of the response? Are they perhaps providing you with a new URL that you would then update your external API request with? It may have something like ?page=2 on the end of the url.

    If this is the case, you could setup a workflow to capture this url as part of a loop and continue to run through the API pages. (This means that your URL in your API will be a dynamic Variable that you can update as part of your loop. This Variable will need to be created before your loop in your functionstack.) In your response is there any other metrics such as items or pages left? You may also have another variable such as pages or items left. You could also setup another variable such as pages or items left before your loop, and each time you loop through your requests update this variable.

    The type of loop I would consider using is a while loop. And the condition would be while Pages or Items left is greater than 0. Upon the final api request, the value will reset to 0 pages or items left, meaning your while loop condition will no longer be true stopping the workflow.

  • iconic
    iconic Member
    Options

    The @datanextlink is the url im getting to enable pagination

  • Lachlan
    Lachlan Administrator

    ADMIN

    edited September 2023
    Options

    Do you know how many events you are looking to capture?

    If so you might use a for_loop in this instance.

    And then for each loop update a "URL" variable that you create prior to your loop starting (You can set the initial value to the value you are currently using for your URL). You'd set your external API request URL to the "URL" variable you have created. Meaning with each loop the URL in your request is going to be updated to the next page url.

  • iconic
    iconic Member
    Options

    for some weird reasons the when i try to create the variable, its not working, this is how i set it up and this is the response im getting

  • iconic
    iconic Member
    Options

    any idea why the variable isnt working?