Looping API get request

Hi Everyone! I’m new with Postman and in JSON/API too so any help you might have is greatly appreciated.

I’m not sure if you are aware of a website named outreach.io and I was successful in fetching some of our data here using postman.

Sadly, they have a limit of returning only 50 resource objects per request so for me to collect all our data, I’d have to create a parameter per ID returned (filter[id]=1…inf) first then the last ID that’ll get returned to me is 50 so I’d have to update the parameter to filter[id]=51…inf.

I’m wondering if you might have an idea on how to possibly make this somewhat automated instead of me updating the parameter. I’m thinking a loop might help but being new with this language, I’m quite confused.

Checking our data, we currently have 71k+ so it might take me a very long time just to do this.

Thanks everyone!

Would you be able to provide an example of the data that is returning, and what specific data you are trying to retrieve? That might help us better help you to find a solution to this problem.

I have had a look at the API documentation for outreach but I am not sure of the date you are trying to retrieve.

Hi Whersh, my apologies here’s a copy of the data I get back after making a request. Let’s say the last ID that appeared is 57369, for me to move to the next batch of records, I’ll increment the last ID (which is 57369) by one. From filter[id]=57369…inf, I’ll update the parameter’s value to 57370…inf.

https://api.outreach.io/api/v2/prospects?fields[prospect]=name,firstName,lastName,createdAt,tags,owner&filter[createdAt]=2019-01-01..inf&filter[id]=57369..inf

{
    "data": [
        {
            "type": "prospect",
            "id": 57369,
            "attributes": {
                "createdAt": "2019-01-01T17:18:55.000Z",
                "firstName": aeriels,
                "lastName": null,
                "name": "aeriels",
                "tags": []
            },
            "relationships": {
                "owner": {
                    "data": {
                        "type": "user",
                        "id": 3
                    }
                }
            },
            "links": {
                "self": "https://api.outreach.io/api/v2/prospects/57369"
            }
        }
}