0

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?

Robert Grezan
  • 1,266
  • 3
  • 13
  • 27
  • We're currently doing exactly that; looking up each individual item to get further metadata. I can understand the other side of the argument; that returning this much data on each request might unnecessary much of the time. Perhaps a way to identify which fields you would like returned on the request would be useful. – Ben Zittlau Sep 29 '12 at 18:53

2 Answers2

3

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/

Peter
  • 2,551
  • 1
  • 14
  • 20
3

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.

seanrose
  • 8,185
  • 3
  • 20
  • 21