I have a Sub that is sending a request to a webservice and gets back a JSON string. I send that string to another Sub to be parsed and I get a value from that JSON string that I store in a global variable.
So far so good, I make the call to the url, I get the Json, I parse it and get the required value and I store it. The value is a NextPageToken that I need to use in the same request if I want to get the next set of JSON data from the server.
Now I try to put everything in a Do Until loop that will play until the NextPageToken is equal with the last value recorded. The problem is that if I put the main Sub in the loop then the loop will continue without waiting for the JSON response and for the JSON string to be parsed.
How can I stop a loop until a certain action or a condition is met?
Or may be somebody can teach me how to get the entire data that I need when the data is split in "pages" in JSON format and require multiple requests?
the URL for the request is this:
The playlist is a random one with over 150 videos inside.
First request is with pageToken empty and the following requests should use the value of pageToken from the JSON response from the first request.
Thank you
So far so good, I make the call to the url, I get the Json, I parse it and get the required value and I store it. The value is a NextPageToken that I need to use in the same request if I want to get the next set of JSON data from the server.
Now I try to put everything in a Do Until loop that will play until the NextPageToken is equal with the last value recorded. The problem is that if I put the main Sub in the loop then the loop will continue without waiting for the JSON response and for the JSON string to be parsed.
How can I stop a loop until a certain action or a condition is met?
Or may be somebody can teach me how to get the entire data that I need when the data is split in "pages" in JSON format and require multiple requests?
the URL for the request is this:
B4X:
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&pageToken=&playlistId=PLsyeobzWxl7oZ-fxDYkOToURHhMuWD1BK&key=yourYTAPIkey
First request is with pageToken empty and the following requests should use the value of pageToken from the JSON response from the first request.
Thank you
Last edited: