উন্নত মানুষ সেবা

অ্যাডভান্সড পিপল সার্ভিস আপনাকে Apps স্ক্রিপ্টে People API ব্যবহার করতে দেয়। এই API স্ক্রিপ্টগুলিকে লগ ইন করা ব্যবহারকারীর জন্য যোগাযোগের ডেটা তৈরি করতে, পড়তে এবং আপডেট করতে এবং Google ব্যবহারকারীদের জন্য প্রোফাইল ডেটা পড়ার অনুমতি দেয়৷

রেফারেন্স

এই পরিষেবার বিস্তারিত তথ্যের জন্য, পিপল এপিআই-এর রেফারেন্স ডকুমেন্টেশন দেখুন। Apps Script-এর সমস্ত উন্নত পরিষেবাগুলির মতো, উন্নত লোক পরিষেবা সর্বজনীন API হিসাবে একই বস্তু, পদ্ধতি এবং পরামিতিগুলি ব্যবহার করে৷ আরও তথ্যের জন্য, দেখুন কিভাবে পদ্ধতি স্বাক্ষর নির্ধারণ করা হয়

সমস্যাগুলি রিপোর্ট করতে এবং অন্যান্য সহায়তা পেতে, People v1 সমর্থন নির্দেশিকা দেখুন।

কোডের উদাহরণ

নীচের নমুনা কোডটি API-এর সংস্করণ 1 ব্যবহার করে।

ব্যবহারকারীর সংযোগ পান

ব্যবহারকারীর পরিচিতিতে থাকা ব্যক্তিদের একটি তালিকা পেতে , নিম্নলিখিত কোডটি ব্যবহার করুন:

উন্নত/মানুষ.জিএস
/**
 * Gets a list of people in the user's contacts.
 * @see https://developers.google.com/people/api/rest/v1/people.connections/list
 */
function getConnections() {
  try {
    // Get the list of connections/contacts of user's profile
    const people = People.People.Connections.list('people/me', {
      personFields: 'names,emailAddresses'
    });
    // Print the connections/contacts
    console.log('Connections: %s', JSON.stringify(people, null, 2));
  } catch (err) {
    // TODO (developers) - Handle exception here
    console.log('Failed to get the connection with an error %s', err.message);
  }
}

ব্যবহারকারীর জন্য ব্যক্তি পান

ব্যবহারকারীর প্রোফাইল পেতে , আপনাকে https://www.googleapis.com/auth/userinfo.profile স্কোপের অনুরোধ করতে হবে আপনার appsscript.json ম্যানিফেস্ট ফাইলে স্পষ্ট স্কোপ যোগ করার জন্য নির্দেশাবলী অনুসরণ করে। একবার সুযোগ যোগ করা হলে, আপনি নিম্নলিখিত কোড ব্যবহার করতে পারেন:

উন্নত/মানুষ.জিএস
/**
 * Gets the own user's profile.
 * @see https://developers.google.com/people/api/rest/v1/people/getBatchGet
 */
function getSelf() {
  try {
    // Get own user's profile using People.getBatchGet() method
    const people = People.People.getBatchGet({
      resourceNames: ['people/me'],
      personFields: 'names,emailAddresses'
      // Use other query parameter here if needed
    });
    console.log('Myself: %s', JSON.stringify(people, null, 2));
  } catch (err) {
    // TODO (developer) -Handle exception
    console.log('Failed to get own profile with an error %s', err.message);
  }
}

একটি Google অ্যাকাউন্টের জন্য ব্যক্তি পান

যেকোনো Google অ্যাকাউন্টের জন্য ব্যক্তির তথ্য পেতে , নিম্নলিখিত কোডটি ব্যবহার করুন:

উন্নত/মানুষ.জিএস
/**
 * Gets the person information for any Google Account.
 * @param {string} accountId The account ID.
 * @see https://developers.google.com/people/api/rest/v1/people/get
 */
function getAccount(accountId) {
  try {
    // Get the Account details using account ID.
    const people = People.People.get('people/' + accountId, {
      personFields: 'names,emailAddresses'
    });
    // Print the profile details of Account.
    console.log('Public Profile: %s', JSON.stringify(people, null, 2));
  } catch (err) {
    // TODO (developer) - Handle exception
    console.log('Failed to get account with an error %s', err.message);
  }
}