Created
June 26, 2023 05:04
-
-
Save ochilab/07b97476a97e533884177a408e28cba1 to your computer and use it in GitHub Desktop.
GAS: Todoistから完了したタスクを取ってくる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
sinceから現在まですべてのタスクをとってくる | |
since: 取得開始する日時 (2023-06-26 というフォーマットの文字列) | |
**/ | |
function todoistGetCompleteItems(since) { | |
const token = PropertiesService.getScriptProperties().getProperty('TODOIST_TOKEN'); | |
const url = 'https://api.todoist.com/sync/v9/completed/get_all?since='+since+'T00:00:00'; | |
const params = { | |
headers: { 'Authorization': `Bearer ${token}` } | |
}; | |
const response = UrlFetchApp.fetch(url, params); | |
const json = response.getContentText(); | |
const obj = JSON.parse(json); | |
const result = obj["items"]; | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment