前提
よろしくお願いします。
GASで notionのテーブルにフィルタをかけたいと考えています。
他のテーブルで同様のコードを書いた際は、きちんと動いていたのですが、このコードに関してはデータベースの内容は取得するものの、どうしてもFilterがかかってくれません。
実現したいこと
指定したデータベースに対しフィルタをかけて結果を取得
発生している問題・エラーメッセージ
どうしてもフィルタがかからない。
該当のソースコード
//notion_token const TOKEN='notion_token' //database_id const DATABASE_ID="notion_DatabaseID" //header部分 const notionHeader=token=>( { 'Contetnt-Type':'application/json; charset=UTF-8', 'Authorization':'Bearer '+token, 'Notion-Version':'2022-02-22' } ) //データベース取得(フィルタ有) function getDataBaseFiltered(database_id,link){ filter={ "filter":{ "property":"link", "url":{ "equals":"link" } } } return sendRequest("https://api.notion.com/v1/databases/"+database_id+"/query",'post',filter) } function sendRequest(url,method,data=null) { let headers=notionHeader(TOKEN); let options; if(data==null){ options={ 'method':method, 'headers':headers, }; }else{ options={ 'method':method, 'headers':headers, 'payload':JSON.stringify(data), }; } let notion_data=UrlFetchApp.fetch(url,options); notion_data=JSON.parse(notion_data); return notion_data; } function main_updateStatus(){ const sheet=SpreadsheetApp.getActiveSpreadsheet().getSheetByName('completed_Task'); var lastrow=sheet.getLastRow(); for(var i=2;i<=lastrow;i++){ var link=sheet.getRange(i,2).getValue(); Logger.log(link); res=getDataBaseFiltered(DATABASE_ID,link); let result=res.results; } }
試したこと
propertyの値の変更等は試しましたが、どの値でも(他のテーブルでは成功していたpropertyでも)動作しませんでした。
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー