I have an api response that I have to paginate through:
func getAllOrgs() []int {
var allOrgIds []int
var listOfAllOrganizations Orgs
var x = 1
for x == 1 {
if listOfAllOrganizations.Nextpage != nil {
DO CODE HERE
}
There’s not enough code here to know what’s going on. Based on how you wrote “next_page:null”, I’m guessing that the API probably returns JSON and that your Orgs struct might have a field like this in it:
And I’m also guessing that you’re deserializing JSON somewhere in (or outside of?) that loop, too. However, because all the important stuff is happening somewhere else, there’s not much help we can give.