توضّح عمليات الإعداد السريع كيفية إعداد تطبيق يستدعي واجهة برمجة التطبيقات
Google Workspace API وتشغيله.
تستخدِم عمليات الإعداد السريع في Google Workspace مكتبات عملاء واجهة برمجة التطبيقات لمعالجة بعض
تفاصيل عملية المصادقة والتفويض. ننصحك باستخدام مكتبات العملاء لتطبيقاتك. يستخدم دليل البدء السريع هذا أسلوب مصادقة بسيطًا ومناسبًا لبيئة الاختبار. بالنسبة إلى بيئة الإنتاج، ننصحك بالاطّلاع على معلومات عن
المصادقة والتفويض
قبل
اختيار بيانات اعتماد الوصول
الملائمة لتطبيقك.
/** * Lists the user's tasks. * @see https://developers.google.com/tasks/reference/rest/v1/tasklists/list */functionlistTaskLists(){constoptionalArgs={maxResults:10};try{// Returns all the authenticated user's task lists.constresponse=Tasks.Tasklists.list(optionalArgs);consttaskLists=response.items;// Print task list of user if available.if(!taskLists||taskLists.length===0){console.log('Notasklistsfound.');return;}for(consttaskListoftaskLists){console.log('%s(%s)',taskList.title,taskList.id);}}catch(err){// TODO (developer) - Handle exception from Task APIconsole.log('Failedwitherror%s',err.message);}}
انقر على رمز الحفظ .
انقر على مشروع بلا عنوان، واكتب
البدء السريع، ثم انقر على إعادة التسمية.
ضبط النص البرمجي
تفعيل Google Tasks API
افتح مشروع Apps Script.
انقر على رمز أداة التعديلcode.
بجانب الخدمات، انقر على رمز إضافة خدمة
add .
اختَر
Tasks API
وانقر على إضافة.
تشغيل العيّنة
في محرِّر Apps Script، انقر على تشغيل.
في المرة الأولى التي تُشغِّل فيها العيّنة، سيُطلَب منك تفويض الوصول:
تاريخ التعديل الأخير: 2024-12-21 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2024-12-21 (حسب التوقيت العالمي المتفَّق عليه)"],[[["This quickstart demonstrates how to create a Google Apps Script that interacts with the Google Tasks API to list tasks."],["Before running the script, you need a Google account with Google Tasks and Drive enabled, and you will need to enable the Google Tasks API within the script."],["The script utilizes Google API client libraries for authentication and is designed for a testing environment; production environments require more robust authentication."],["After configuring and running the script, it will prompt for authorization to access your Google Tasks data and then display your task lists in the execution log."],["For more advanced usage and troubleshooting, refer to the provided links for Google Apps Script, authentication, and the Tasks API."]]],["This content details how to create and run a Google Apps Script that interacts with the Google Tasks API. Key actions include creating a new script, replacing the default code with a provided sample to list task lists, saving and renaming the script, and enabling the Tasks API within the script's services. Running the script requires authorizing access, after which it will display the user's task lists in the execution log, or error if failed. It use a simplified authorization and suggest to do more in depth authorization for production.\n"]]