「Tasks API」の編集履歴(バックアップ)一覧に戻る

Tasks API - (2012/06/10 (日) 20:44:15) の編集履歴(バックアップ)


Developer's API Documentation : Tasks

同期 Syncing

多くのサードパーティ製アプリケーションの主たる目的は、タスクの同期をすることです。この勧めに従えば、きれいで効率的にタスクを同期することができます。最重要事項の一つとしては、「タスク最終更新」("lastedit_task")または「タスク最終削除」("lastdelete_task")のタイムスタンプを用いることです。これはアカウント情報("Account Info")から返されるもので、アプリケーションがサーバーから差分を取得・更新・削除する前に、サーバー上で変更があったかどうかを知ることができます。たいていの場合は、同期してもサーバー上に変更はなく、何もする必要がないので、タイムスタンプを用いることによって処理量・時間を大きく削減することができます。
Syncing tasks is the main purpose of most third-party applications. If you use the following recommendations you can sync cleanly and efficiently. One of the most important things is to use the "lastedit_task" and "lastdelete_task" timestamps, returned from Account Info, to determine if any changes have happened on the server before you fetch anything. In the vast majority of cases, when syncing, nothing will have changed on the server and you won't even need to do anything.

(本家サイトより拝借・加工。問題がある場合はご連絡ください)

アプリケーションとToodledoとの同期においては、以下の7つのシナリオを扱えなければなりません。

  1. アプリケーションへのタスク追加
  2. アプリケーションでのタスク更新
  3. アプリケーションからのタスク削除
  4. Toodledoサーバへのタスク追加
  5. Toodledoサーバでのタスク更新
  6. Toodledoサーバからのタスク削除
  7. アプリケーションとサーバ双方でタスクが変更されている

シナリオ1, 2, 3では、アプリケーションはタスクを追加・更新・削除するために、それぞれ /tasks/add.php, /tasks/edit.php, /tasks/delete.php のAPIを用いることになります。追加と削除の場合は事前チェックの必要はありませんが、更新をする前には差分を取得し、修正日の比較をすることにより、タスクのより新しい更新を上書きしてしまわないようにしなければなりません。
For scenarios 1,2 and 3, your application will need to use the "/tasks/add.php", "/tasks/edit.php" or "/tasks/delete.php" API calls to add/edit/delete the task. Adding and deleting can be done without checking, but before you edit a task, you should first fetch it and compare the modification dates to make sure you are not overwriting a more recent version of the task.
シナリオ4, 5, 6では、アプリケーションはそれぞれ /tasks/get.php または /tasks/get_deleted.php のAPIを用いることになります。シナリオ7では、アプリケーションは修正日を比較し、双方で更新されているのかどうかを判断した後、ユーザーにどちらの版を残すかを尋ねます。すべてのシナリオは上のフローチャートに従うことで効率よく処理することができます。
For scenarios 4,5 and 6, your application will need to use the "/tasks/get.php" and "/tasks/get_deleted.php" API calls to fetch the updated information. For scenario 7, your application will have to compare modification dates and determined that the task has been updated in both places. Your application should prompt the user and ask them which version of the task they want to keep. See the flowchart for an efficient way to handle all scenarios.

タスクの属性