Ordering of get folder items API call

橙三吉。 提交于 2019-12-13 04:38:04

问题


I am using the get folder items API call, and I can tell from my tests that the order appears to be folders first and then alphabetical.

Is this call guaranteed to always return items in that order?


回答1:


Box Platform team member here ... we do not consider the order of the results returned by any of our collections endpoints part of their public contract and they are subject to change. For GET /folders/id/items at least, the JSON response includes an order array, which shows how the response is ordered.

{
    "total_count": 6,
    "entries": [
        {
            "type": "folder",
            "id": "192429928",
            "sequence_id": "1",
            "etag": "1",
            "name": "Lebron and Friends"
        },
        {
            "type": "folder",
            "id": "192429929",
            "sequence_id": "1",
            "etag": "1",
            "name": "Stephen Curry Three Pointers"
        },
        {
            "type": "file",
            "id": "818853864",
            "sequence_id": "0",
            "etag": "0",
            "name": "Heat.jpg"
        },
        {
            "type": "file",
            "id": "818853862",
            "sequence_id": "0",
            "etag": "0",
            "name": "Warriors.jpg"
        }
    ],
    "offset": 0,
    "limit": 4,
    "order": [
        {
            "by": "type",
            "direction": "ASC"
        },
        {
            "by": "name",
            "direction": "ASC"
        }
    ]
}

Note that this response can also include web links.

If your app depends on the list of items being ordered a certain way, we recommend sorting on the client.



来源:https://stackoverflow.com/questions/19547380/ordering-of-get-folder-items-api-call

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!