Reading data after getJSON reading Pagination Codes

This is related to my previous request for Reading data after getJSON

Hugo Go Help with GetJSON

I am seeking help with using Hugo and GetJSON for my project

For the most part, this has worked well, and most applications are straightforward.

However, I am currently working on a project that requires me to retrieve the full list of events for a company using the EventBrite API. Currently, the feed cuts off after approximately three months of data out of 12 months of events.

The API documentation offers a solution using pagination.

The API supplies pagination data that includes a continuation code, which can be used in a subsequent call to the same API endpoint to move the pointer to the next batch of events. This can be repeated until the pagination header item called “has_more_items” is false.

I have tested this in Postman, and the API does return a new continuation code until all the data has been read. However, when I try to simulate this using GetJSON, I only get the first page of events with the correct continuation code. Using a loop with {{ range sep (number of pages }} to call the endpoint repeatedly for the given number of pages produces the same output even with the updated continuation code.

I suspect that something is happening with GetJSON or with the loop that does not allow for the slight changes in the continuation code to be recognised.

Query Summary:

I would like to know if there is something preventing this loop from progressing throughout the data set with the EventBrite pagination.

I suspect:

a) There may be some limitation with repeated GetJSON calls (I do not want to change the global Cache setting for this one item).

b) There may be something in the scoping of the range loop.

c) Scratch variables are used to store the pagination data. Should they be available for the entire page, with the range loop?

I am hoping that someone here has some experience with this type of repeating API call.

I have included some example code.

In my early days of programming, we were never allowed to touch a computer keyboard to program before we had laid out our flowcharts on paper. Here is my high level diagram.

{{ define "bodyClass"}}
{{define "body" }}
{{ $bearer := getenv "HUGO_EVENTHUGO_EVENTBRITE_API_KEY"}}
{{ $bearerID :=  print   "Bearer "    $bearer  }}
{{ $organisation_id := getenv "HUGO_EB_ORGANISATION_ID"}}
{{ $venue_id := getenv "HUGO_EB_VENUE_ID"}}

<main class="" style="color: rgb(237, 233, 233)">
{{ partial "utils/testmodemessage.html" (dict "message" "INDEX PAGE FOR EVENTS PAGE" )  }}
{{ $bearerID }}
{{ $eventbriteDataStore := newScratch }}
{{ $urlstringlive := newScratch }}
{{ $counter := newScratch }}
{{ $eventbriteDataStore.Add "continuation" "eyJwYWdlIjogM0" }}
{{ $resultsData := "" }}
{{$has_more_items :=  ""}}
{{$urlstring := ""}}
{{  $urlstringlive.Set "urlstring"  (print ",started&time_filter=current_future&order_by=start_asc&expand=logo%2Clogoid/?continuation=eyJwYWdlIjogM0")  }}
{{  $resultsData := partial   "custom/eventbrite_api_partial.html"  ( $urlstringlive.Get "urlstring" ) ($eventbriteDataStore.Get "continuation") "firstcall"}}
{{ $eventbriteDataStore.Set  "events" $ }}
{{ $eventbriteDataStore.Set "pagecount" $resultsData.pagination.page_count }}
{{ $eventbriteDataStore.Set "contination" $resultsData.pagination.contination }}
{{ $eventbriteDataStore.Set "has_more_items" $resultsData.pagination.has_more_items }}
{{ $eventbriteDataStore.Get "continuation" }}
{{ range seq ($resultsData.pagination.page_count)}}
{{ $resultsData := partial   "custom/eventbrite_api_partial.html"  ( $urlstringlive.Get "urlstring" ) "secjkh" }}
{{ $eventbriteDataStore.Set  "continuation"  ($resultsData.pagination.contination)  }}
{{ $eventbriteDataStore.Get "continuation"}}
{{ $eventbriteDataStore.Add  "events" ($ }}
<!-- {{range $eventbriteDataStore.Get "events"}}
{{end}} -->
<!-- {{ $eventbriteDataStore.Get "events" }} -->
        <a href="/"class="centerer" alt="Home" title="Back to main page">Home</a>

{{ define “bodyClass”}}
{{define “body” }}
{{ $bearer := getenv “HUGO_EVENTHUGO_EVENTBRITE_API_KEY”}}
{{ $bearerID := print "Bearer " $bearer }}
{{ $organisation_id := getenv “HUGO_EB_ORGANISATION_ID”}}
{{ $venue_id := getenv “HUGO_EB_VENUE_ID”}}

{{ partial "utils/testmodemessage.html" (dict "message" "INDEX PAGE FOR EVENTS PAGE" ) }} {{ $bearerID }} {{ $eventbriteDataStore := newScratch }} {{ $urlstringlive := newScratch }} {{ $counter := newScratch }} {{ $eventbriteDataStore.Add "continuation" "eyJwYWdlIjogM0" }} {{ $resultsData := "" }} {{$has_more_items := ""}} {{$urlstring := ""}} {{ $urlstringlive.Set "urlstring" (print ",started&time_filter=current_future&order_by=start_asc&expand=logo%2Clogoid/?continuation=eyJwYWdlIjogM0") }} {{ $resultsData := partial "custom/eventbrite_api_partial.html" ( $urlstringlive.Get "urlstring" ) ($eventbriteDataStore.Get "continuation") "firstcall"}} {{ $eventbriteDataStore.Set "events" $ }} {{ $eventbriteDataStore.Set "pagecount" $resultsData.pagination.page_count }} {{ $eventbriteDataStore.Set "contination" $resultsData.pagination.contination }} {{ $eventbriteDataStore.Set "has_more_items" $resultsData.pagination.has_more_items }} {{ $eventbriteDataStore.Get "continuation" }} {{ range seq ($resultsData.pagination.page_count)}} {{ $resultsData := partial "custom/eventbrite_api_partial.html" ( $urlstringlive.Get "urlstring" ) "secjkh" }} {{ $eventbriteDataStore.Set "continuation" ($resultsData.pagination.contination) }} {{ $eventbriteDataStore.Get "continuation"}} {{ $eventbriteDataStore.Add "events" ($ }} {{end}}



Many thank in advance.