Nexmo / nexmo-cli

Nexmo CLI (Command Line Interface)
https://nexmo.com
MIT License
78 stars 52 forks source link

nexmo apps:list --size does not show a list of the expected size #102

Closed leggetter closed 7 years ago

leggetter commented 7 years ago

In the following command I would expect 50 entries to be shown. But only 10 are shown.

› nexmo apps:list --verbose --size 50
Item 1-50 of 52

id                                   | name
------------------------------------------------------
019cb774-4ad0-4b22-a9db-86a8e7df1d34 | nexmo-node-test
01f7e4a5-ea15-48da-a3c3-f792089443a0 | First Voice App
03f31f24-c2e9-4193-9d71-7a5fd9fc0c70 | First Voice App
0b5d3fec-eac5-4b55-b71c-60874f981659 | First Voice App
0b5f2c87-1355-438b-99b9-7046eec89476 | 1473368357732
0ce0271e-a438-4fdb-8eb2-ca03932b5f2c | my-voice-app
178c9b62-571c-4328-959c-0cf9a49b354f | watson-test
18cdaa6c-e69f-475a-b2e6-b63b9ce20674 | First Voice App
1cc45c5a-0d08-4bff-9f36-5b0dbfa69881 | Blah
22edf392-bd50-42ad-b885-98f891da4b6a | First Voice App
cbetta commented 7 years ago

Going off the debug log it seems the API does not return 50 items:

info: Request: { host: 'api.nexmo.com',
  port: 443,
  path: '/v1/applications?size=50&&api_key=****&api_secret=*****',
  method: 'GET',
  headers: 
   { 'Content-Type': 'application/x-www-form-urlencoded',
     Accept: 'application/json',
     'User-Agent': 'nexmo-node/1.1.0-beta1/v6.7.0' } } 
Body: undefined
info: response ended: 200
Validator.response() - Error: 
null
Validator.response() - Response: 
{ count: 69,
  page_size: 10,
  page_index: 1,
  _embedded: 
   { applications: 
      [ [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object] ] },
  _links: 
   { self: { href: '/v1/applications?page_size=10&page_index=1' },
     first: { href: '/v1/applications?page_size=10' },
     last: { href: '/v1/applications?page_size=10&page_index=7' },
     next: { href: '/v1/applications?page_size=10&page_index=2' } } }
End Validator.response()
cbetta commented 7 years ago

Found the problem: this API endpoint does not use size but page_size