क्विकस्टार्ट में, Google Workspace API को कॉल करने वाले ऐप्लिकेशन को सेट अप और चलाने का तरीका बताया गया है. इस क्विकस्टार्ट में, पुष्टि करने का आसान तरीका इस्तेमाल किया गया है. यह टेस्टिंग एनवायरमेंट के लिए सही है. हमारा सुझाव है कि प्रोडक्शन एनवायरमेंट के लिए, ऐक्सेस क्रेडेंशियल चुनने से पहले, पुष्टि करने और अनुमति देने के बारे में जान लें. इससे आपको अपने ऐप्लिकेशन के लिए सही क्रेडेंशियल चुनने में मदद मिलेगी.
Apps Script में, Google Workspace की क्विकस्टार्ट गाइड, Google Workspace API को कॉल करने के लिए Google की ऐडवांस सेवाओं का इस्तेमाल करती हैं. साथ ही, पुष्टि करने और अनुमति देने के फ़्लो की कुछ जानकारी को मैनेज करती हैं.
/** * Print the display name if available for 10 connections. */functionlistConnectionNames(){try{/** * List the 10 connections/contacts of user * @see https://developers.google.com/people/api/rest/v1/people.connections/list */constconnections=People.People.Connections.list('people/me',{pageSize:10,personFields:'names,emailAddresses'// use other query parameter here if needed.});connections.connections.forEach((person)=>{// if contacts/connections is available, print the name of person.if(person.names && person.names.length===0){console.log('No display name found for connection.');return;}console.log(person.names[0].displayName);});}catch(err){// TODO (developer) - Handle exception from People APIconsole.log('Failed with error %s',err.message);}}
सेव करें पर क्लिक करें.
बिना टाइटल वाला प्रोजेक्ट पर क्लिक करें. इसके बाद, Quickstart टाइप करें और नाम बदलें पर क्लिक करें.
स्क्रिप्ट को कॉन्फ़िगर करना
People API को चालू करना
Apps Script प्रोजेक्ट खोलें.
एडिटरcode पर क्लिक करें.
सेवाएं के बगल में, सेवा जोड़ें
add पर क्लिक करें .
People API चुनें और जोड़ें पर क्लिक करें.
सैंपल चलाना
Apps Script एडिटर में, चलाएं पर क्लिक करें.
पहली बार सैंपल चलाने पर, आपको ऐक्सेस करने की अनुमति देने के लिए कहा जाएगा:
अनुमतियों की समीक्षा करें पर क्लिक करें.
कोई खाता चुनें.
अनुमति दें पर क्लिक करें.
स्क्रिप्ट के एक्ज़ीक्यूशन का लॉग, विंडो में सबसे नीचे दिखता है.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-08-04 (UTC) को अपडेट किया गया."],[[["This quickstart demonstrates how to use Google Apps Script to access the People API and retrieve a list of connections."],["Before starting, ensure you have a Google Workspace domain with API access enabled and a Google Account with administrator privileges."],["The guide walks you through creating, configuring, and running a script that prints the display names of your connections."],["You'll need to enable the People API in your Apps Script project and authorize the script to access your Google account."],["For production environments, Google recommends reviewing authentication and authorization best practices."]]],["This document guides users to create and run a Google Apps Script that interacts with the People API. It involves configuring a new script on `script.google.com`, replacing the script editor's content with provided code, saving, and renaming the project. Users must enable the People API as a service within the script and authorize access during the initial run. The script then lists the display names of 10 connections. Production environments need appropriate authentication credentials.\n"]]