delta equivalent for Core API v2

Dropbox API v2 的 delta 換成了很長的名字,而且原本的 server timestamp  也被加密順便也加入了一些使用者勾選的參數在裡面。

API v1 的 /delta 功能是 to track changes inside Dropbox.

delta 有2種人在看,一種是給人去看的,相對就不利於同步程式去判斷,另一種是給同步程式去看的,用來檢查最近異動的檔案。這次 Dropbox API v2 我覺得改的滿棒的,是改成給機器看。

實際測試如下:

使用者先刪除server 上的檔案。再上傳檔案到同一個路徑上,v2 的 delta 是顯示最終狀態,只丟出一個節點有異動:

    {
      ".tag": "file",
      "name": "Screenshot 2017-02-07 19.09.33.jpg",
      "path_lower": "/a?bc/hello/h-v3/from4-to-5/screenshot 2017-02-07 19.09.33.jpg",
      "path_display": "/a?bc/hello/h-v3/from4-to-5/Screenshot 2017-02-07 19.09.33.jpg",
      "id": "id:fR7lVuHVChEAAAAAAABdIw",
      "client_modified": "2017-02-08T21:19:56Z",
      "server_modified": "2017-02-08T21:19:56Z",
      "rev": "192b305eb9841",
      "size": 69503,
      "content_hash": "e28d284644bb67c2cd11323bbeea3ce537b21b6725f2092e687f4ea48fd5bb99"
    }

修改檔案名稱,變成2個節點有異動

    {
      ".tag": "deleted",
      "name": "Screenshot 2017-02-07 19.09.33.jpg",
      "path_lower": "/a?bc/hello/h-v3/from4-to-5/screenshot 2017-02-07 19.09.33.jpg",
      "path_display": "/a?bc/hello/h-v3/from4-to-5/Screenshot 2017-02-07 19.09.33.jpg"
    },
    {
      ".tag": "file",
      "name": "Screenshot 2017-02-07 19.09.33-2.jpg",
      "path_lower": "/a?bc/hello/h-v3/from4-to-5/screenshot 2017-02-07 19.09.33-2.jpg",
      "path_display": "/a?bc/hello/h-v3/from4-to-5/Screenshot 2017-02-07 19.09.33-2.jpg",
      "id": "id:fR7lVuHVChEAAAAAAABdIw",
      "client_modified": "2017-02-08T21:19:56Z",
      "server_modified": "2017-02-08T21:21:39Z",
      "rev": "192b505eb9841",
      "size": 69503,
      "content_hash": "e28d284644bb67c2cd11323bbeea3ce537b21b6725f2092e687f4ea48fd5bb99"
    }

再重新上傳一個相同的檔案,新的檔案取得新的 id, content_hash和之前上傳的一樣,異動了2個節點。

    {
      ".tag": "file",
      "name": "Screenshot 2017-02-07 19.09.33-2.jpg",
      "path_lower": "/a?bc/hello/h-v3/from4-to-5/screenshot 2017-02-07 19.09.33-2.jpg",
      "path_display": "/a?bc/hello/h-v3/from4-to-5/Screenshot 2017-02-07 19.09.33-2.jpg",
      "id": "id:fR7lVuHVChEAAAAAAABdIw",
      "client_modified": "2017-02-08T21:19:56Z",
      "server_modified": "2017-02-08T21:21:39Z",
      "rev": "192b505eb9841",
      "size": 69503,
      "content_hash": "e28d284644bb67c2cd11323bbeea3ce537b21b6725f2092e687f4ea48fd5bb99"
    },
    {
      ".tag": "file",
      "name": "Screenshot 2017-02-07 19.09.33.jpg",
      "path_lower": "/a?bc/hello/h-v3/from4-to-5/screenshot 2017-02-07 19.09.33.jpg",
      "path_display": "/a?bc/hello/h-v3/from4-to-5/Screenshot 2017-02-07 19.09.33.jpg",
      "id": "id:fR7lVuHVChEAAAAAAABdJA",
      "client_modified": "2017-02-08T21:22:27Z",
      "server_modified": "2017-02-08T21:22:27Z",
      "rev": "192b605eb9841",
      "size": 69503,
      "content_hash": "e28d284644bb67c2cd11323bbeea3ce537b21b6725f2092e687f4ea48fd5bb99"
    }

1


 

最後的執行截圖:

 


一口氣建立超深資料夾:

"/a:bc/hello/1/2.3/4"
[
    {
      ".tag": "folder",
      "name": "4",
      "path_lower": "/a:bc/hello/1/2.3/4",
      "path_display": "/a:bc/hello/1/2.3/4",
      "id": "id:fR7lVuHVChEAAAAAAABdKw"
    },
    {
      ".tag": "folder",
      "name": "hello",
      "path_lower": "/a:bc/hello",
      "path_display": "/a:bc/hello",
      "id": "id:fR7lVuHVChEAAAAAAABdKg"
    },
    {
      ".tag": "folder",
      "name": "1",
      "path_lower": "/a:bc/hello/1",
      "path_display": "/a:bc/hello/1",
      "id": "id:fR7lVuHVChEAAAAAAABdKQ"
    },
    {
      ".tag": "folder",
      "name": "2.3",
      "path_lower": "/a:bc/hello/1/2.3",
      "path_display": "/a:bc/hello/1/2.3",
      "id": "id:fR7lVuHVChEAAAAAAABdKA"
    }
  ]

 

 

相關文章:

delta equivalent for Core API v2
https://www.dropboxforum.com/t5/API-support/delta-equivalent-for-Core-API-v2/td-p/176292

Dropbox Api v2 – confusion with cursor and paging for list_folders
http://stackoverflow.com/questions/38483875/dropbox-api-v2-confusion-with-cursor-and-paging-for-list-folders

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *