That entire query would be returned as the JSON object from a single API call.
You can learn more about how to parse API calls from my tutorial: API JSON Tutorial (Video)
Edit: I see you posted a screenshot right when I was replying. So perhaps my advice is not all that helpful.
Post a link to the API documentation. We would need to know how to properly authenticate to it since that’s what the error message is about.