google-api-nodejs-client
google-api-nodejs-client copied to clipboard
How to use maxResults in inappproducts.list
Hello, I'm tring to get full list of in app products of an android application. This is my code:
const androidpublisher = require('@googleapis/androidpublisher')
[...]
const auth = new androidpublisher.auth.GoogleAuth({
keyFilename: path.join(__dirname, '..', 'config', 'credential.json'),
scopes: ['https://www.googleapis.com/auth/androidpublisher']
})
const client = await androidpublisher.androidpublisher({
version: 'v3',
auth: await auth.getClient()
})
const { data } = await client.inappproducts.list({
packageName,
maxResults: 1000,
token
})
But I'm not able to get more than 100 products per request, maxResults seems not to work. Where I'm wrong?
Thank you
Do you have a full sample that I can run from the npm command line?
Hi @SurferJeffAtGoogle , ok I try to fix a bit, but i can't share the whole code because there are other parts.
Also you need to customize it by setting PATH_TO_JSON_CREDENTIALS_FILE and YOUR_PACKAGE_NAME with your configurations.
Thank you.
const androidpublisher = require('@googleapis/androidpublisher')
async function main () {
const auth = new androidpublisher.auth.GoogleAuth({
keyFilename: 'PATH_TO_JSON_CREDENTIALS_FILE',
scopes: ['https://www.googleapis.com/auth/androidpublisher']
})
const authClient = await auth.getClient()
const client = await androidpublisher.androidpublisher({
version: 'v3',
auth: authClient
})
const { data } = await client.inappproducts.list({
packageName: 'YOUR_PACKAGE_NAME',
maxResults: 1000
})
console.log(data.length)
}
main()
Hi @SurferJeffAtGoogle forgive me, is there any good news? Thank you
What do I set for YOUR_PACKAGE_NAME?
@SurferJeffAtGoogle your android app package name.
I don't have an android app package name.
@tjohns, please help this user.
@AleeeKoi the response from list should contain a variable tokenPagination, which you will then pass to subsequent calls to get the next page of results, setting maxResults does not have an effect.