Reputation: 1
I am trying to get the search terms,but it is returning 32k records at once. I want to limit the result and implement pagination so that it returns 100 records at a time. I can't find anything in the docs for the npm package.
Upvotes: 0
Views: 23
Reputation: 56
You can set limit in query :
const query = `SELECT campaign.id, campaign.name,metrics.clicks FROM campaign LIMIT 100`;
const response = await customer.query({
query: query,
page_size: 100,
page_token: pageToken,
});
console.log('Results:', response.results);
pageToken = response.next_page_token;
You can use do while loop for fetching all data until pageToken
has value.
Upvotes: 0