Pagination in postman

hello everyone i m new to postman i dont know much
i m using fresh desk api to get data i read there documentation to get all data we need to do pagination so . in postman header part i can see there is link for second page so question is how can i do pagination Do i have to manually copy that link then press send or there is a automated way ??

How I found the problem:

I’ve already tried:

Hi @abhisheksingh25

What are you trying to do?
Are you just loading the pages manually on the screen?
Or are you extracting data from the response body (of each page) to be used elsewhere?

i want extract data from response but issue is that fresh desk api allow only 100 data at a time and in result header i can see second page link soo do i have to manually copy that link and hit request till last page ???
Hope i explain properly

I don’t know if this is the sort of thing you are looking for but, you could write a script that grabs the URL for the next page. Something like this;


let nextURL = pm.response.headers.get('WhatEverYourHeaderIsCalled');
console.log(nextURL);

const options = {
    url: nextURL,  // <-- variable from above
    method: 'GET',
    header: {
        'Content-Type': 'application/json'
    }
}

pm.sendRequest(options, (error, response) => {
    if (error) throw new Error(error);
    //DO STUFF HERE
    //For examples;
    let responseBody = response.json();
    console.log(responseBody);
});