Reputation: 1274
This is feedback based on Box.net comment on developer page asking for v2 feedback.
What the api currently returns for each folder "entry" is something like:
"entries" :
[
{
"sequence_id": "0",
"type": "file",
"id": "2631999573",
"name":"IMG_1312.JPG"
},
{
"type":"folder",
"id":"2305623799",
"sequence_id":"1",
"name":"a child folder"
}
]
This means that to retrieve basic metadata (size, modification date etc) for a child entry I have to issue a REST request for each item. This is clearly very inefficient.
The question is: is there any chance that this will be changed in before v2 is released?
Upvotes: 0
Views: 315
Reputation: 8685
When you make an API call to retrieve a folder's items, i.e.
GET /folders/{folder id}/items
You can specify an optional fields
parameter with a comma-separated list of what attributes you want returned in the resultant items collection. The attributes can be any of those listed for the full file and folder objects.
For example, if I make this call
GET /folders/{id}/items?fields=name,modified_at,description
I will get this response
{
"total_count":2,
"entries":[
{
"type":"file",
"id":"2305649799",
"name":"a file",
"modified_at":"2012-06-04T21:32:21-07:00",
"description":"hey look it's a file"
},
{
"type":"folder",
"id":"2305649799",
"name":"a folder",
"modified_at":"2012-06-04T21:32:21-07:00",
"description":"hey look it's a folder"
}
]
}
type and id are always returned in order to be able to properly identify the item.
Upvotes: 3
Reputation: 2599
Did you see the new blog post we put up just Friday about the ?fields support that we're rolling out for the V2 endpoints? This should address exactly what you are asking for, in that you can ask for more fields to be returned.
http://developers.blog.box.com/2012/09/28/exciting-new-v2-updates/
Upvotes: 3