Private Sub GetContestsNew
Dim job As HttpJob
Dim Data As Map
Dim Items As List
Dim i As Long
Dim strTeams As String
Dim NextPage As String
Dim blnNextPage As Boolean
Items.Initialize
job.Initialize("", Me)
ProgressDialogShow("Download Contests from ASLT server...")
blnNextPage = True
Do Until blnNextPage = False
If NextPage <> "" Then
job.Download(Starter.strURL & "contests/?cursor=" & NextPage)
Else
job.Download(Starter.strURL & "contests/")
End If
job.GetRequest.SetHeader("Authorization", "Token " & Starter.gToken)
Wait For (job) JobDone(job As HttpJob)
If job.Success Then
Data = job.GetString.As(JSON).ToMap
NextPage = Data.Get("next")
Items.AddAll(Data.Get("results"))
Else
Log(job.ErrorMessage)
Log(job.Response)
End If
If NextPage.Length < 5 Then blnNextPage = False
Loop