如何使用Dropbox API获取项目的修订版 [英] How to get the revision of an item with Dropbox API

查看:69
本文介绍了如何使用Dropbox API获取项目的修订版的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用Dropbox API来获取有关文件的详细信息.因此,我需要向用户显示文件版本号.但是, rev 项将返回类似于"35c1f029684fe"的文件版本.这与显示版本1或版本0的Dropbox UI不一致.如何获得此版本号?

I am currently using the Dropbox API to get details about files. So I need show the user the file version number. However, the rev item will return a file version which is like "35c1f029684fe". This is not consistent with the Dropbox UI which shows Version 1 or Version 0. How can I get this version number?

推荐答案

浏览了他们的文件/文件夹元数据之后,我没有看到提供所需数字的任何字段.相反,您可以使用修订版API .

Having browsed through their file/folder metadata, I don't see any field that gives the number you want. Instead, you can use the revisions API.

https://api.dropbox.com/1/revisions/<root>/<path>

这将返回类似的内容:

[
    {
        "is_deleted": true,
        "revision": 4,
        "rev": "40000000d",
        "thumb_exists": false,
        "bytes": 0,
        "modified": "Wed, 20 Jul 2011 22:41:09 +0000",
        "path": "/hi2",
        "is_dir": false,
        "icon": "page_white",
        "root": "app_folder",
        "mime_type": "application/octet-stream",
        "size": "0 bytes"
    },
    {
        "revision": 1,
        "rev": "10000000d",
        "thumb_exists": false,
        "bytes": 3,
        "modified": "Wed, 20 Jul 2011 22:40:43 +0000",
        "path": "/hi2",
        "is_dir": false,
        "icon": "page_white",
        "root": "app_folder",
        "mime_type": "application/octet-stream",
        "size": "3 bytes"
    }
]

记下修订号.但是,有两个警告.文档中的一些相关摘录(重点是我的话):

Note the revision numbers. There are a couple of caveats, though; some relevant snippets from the docs (emphasis mine):

仅提供长达三十天的修订版本(如果Dropbox用户具有Packrat).[...]rev_limit默认值为10.最大为1,000.修订将被返回.

Only revisions up to thirty days old are available (or more if the Dropbox user has Packrat). [...] rev_limit Default is 10. Max is 1,000. Up to this number of recent revisions will be returned.

似乎默认参数将首先返回您的最新修订.您可以验证是否是这种情况;如果是这样,它应该可以很好地满足您的需求.

It seems like the default parameters will return you the most recent revisions first. You can verify if this is the case; if so, it should meet your needs nicely.

这篇关于如何使用Dropbox API获取项目的修订版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆