box-node-sdk icon indicating copy to clipboard operation
box-node-sdk copied to clipboard

array for fields option when using getItems

Open wimdecorte opened this issue 3 years ago • 1 comments

client.folders.getItems(id,{ offset: offset, limit: limit, fields: ['name','modified_at'], sort: 'date', direction: 'DESC' })

when I add fields to an array as above, only the first item in the array is returned in the response. any other fields in the array are ignored.

The docs don't really help because all the examples show adding just one field.

What am I missing?

wimdecorte avatar Sep 23 '21 14:09 wimdecorte

Answering my own question: it doesn't take an array, just a comma separated string of fields names. Not intuitive IMHO. Plus the code should throw a meaningful error if you feed it an array when it is not expecting one.

This works: client.folders.getItems(id,{ offset: offset, limit: limit, fields: 'name,modified_at', sort: 'date', direction: 'DESC' })

wimdecorte avatar Sep 23 '21 14:09 wimdecorte

This issue has been automatically marked as stale because it has not been updated in the last 30 days. It will be closed if no further activity occurs within the next 7 days. Feel free to reach out or mention Box SDK team member for further help and resources if they are needed.

stale[bot] avatar Dec 19 '22 19:12 stale[bot]

This issue has been automatically closed due to maximum period of being stale. Thank you for your contribution to Box Node SDK and feel free to open another PR/issue at any time.

stale[bot] avatar Dec 26 '22 20:12 stale[bot]