क्विकस्टार्ट में, Google Workspace API को कॉल करने वाले ऐप्लिकेशन को सेट अप और चलाने का तरीका बताया गया है. इस क्विकस्टार्ट में, पुष्टि करने का आसान तरीका इस्तेमाल किया गया है. यह टेस्टिंग एनवायरमेंट के लिए सही है. हमारा सुझाव है कि प्रोडक्शन एनवायरमेंट के लिए, ऐक्सेस क्रेडेंशियल चुनने से पहले, पुष्टि करने और अनुमति देने के बारे में जान लें. इससे आपको अपने ऐप्लिकेशन के लिए सही क्रेडेंशियल चुनने में मदद मिलेगी.
Apps Script में, Google Workspace के क्विकस्टार्ट, Google Workspace API को कॉल करने के लिए Google की ऐडवांस सेवाओं का इस्तेमाल करते हैं. साथ ही, पुष्टि करने और अनुमति देने के फ़्लो की कुछ जानकारी को मैनेज करते हैं.
/** * @typedef {Object} EmailAddress * @see https://developers.google.com/people/api/rest/v1/people#Person * @property {string} value * Note: This is a partial definition. *//** * @typedef {Object} Name * @see https://developers.google.com/people/api/rest/v1/people#Person * @property {string} displayName * Note: This is a partial definition. *//** * @typedef {Object} Person * @see https://developers.google.com/people/api/rest/v1/people#Person * @property {Name[]} names * @property {EmailAddress[]} [emailAddresses] * Note: This is a partial definition. *//** * @typedef {Object} Connection * @see https://developers.google.com/people/api/rest/v1/people.connections/list * @property {Person[]} connections * Note: This is a partial definition. *//** * Print the display name if available for 10 connections. */functionlistConnectionNames(){// Use the People API to list the connections of the logged in user.// See: https://developers.google.com/people/api/rest/v1/people.connections/listif(!People||!People.People||!People.People.Connections){thrownewError("People service not enabled.");}constconnections=People.People.Connections.list("people/me",{pageSize:10,personFields:"names,emailAddresses",});if(!connections.connections){console.log("No connections found.");return;}for(constpersonofconnections.connections){if(person.names&&
person.names.length > 0&&
person.names[0].displayName){console.log(person.names[0].displayName);}else{console.log("No display name found for connection.");}}}
सेव करें पर क्लिक करें.
बिना टाइटल वाला प्रोजेक्ट पर क्लिक करें. इसके बाद, 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"]],["आखिरी बार 2026-09-15 (UTC) को अपडेट किया गया."],[],["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"]]