admin管理员组

文章数量:1122846

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.

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.

Share Improve this question asked Nov 22, 2024 at 7:35 Bipasha RoyBipasha Roy 1
Add a comment  | 

1 Answer 1

Reset to default 0

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.

本文标签: nodejsHow can I implement pagination using the googleadsapi Node js packageStack Overflow