ใช้งานพื้นที่ทํางานในการประชุม

Google Meet REST API
ภาพประกอบ

คู่มือนี้จะอธิบายวิธีสร้าง รับ และอัปเดตพื้นที่การประชุม รวมถึงวิธีปิดการประชุมที่ดำเนินอยู่จากแหล่งข้อมูล spaces ของ Google Meet REST API

สถานที่ประชุมแสดงสถานที่เสมือนหรือออบเจ็กต์ถาวร (เช่น ห้องประชุม) ที่ใช้ในการจัดการประชุม คุณจะจัดการประชุมที่ใช้งานอยู่ได้เพียง 1 รายการในพื้นที่ทำงานเดียวเท่านั้น พื้นที่ทำงานยังช่วยให้ผู้ใช้พบปะและค้นหาทรัพยากรที่แชร์ได้ด้วย

ดูวิธีกำหนดค่าพื้นที่การประชุมแบบเป็นโปรแกรมได้ที่กำหนดค่า พื้นที่การประชุมและสมาชิก

ตารางต่อไปนี้แสดงรายละเอียดบทบาทในการประชุมที่จําเป็นต่อการใช้วิธีการต่างๆ ในพื้นที่การประชุม

วิธีการ เจ้าของ ผู้เข้าร่วม อื่นๆ
endActiveConference() x
get() x x x
     ที่มีการตั้งค่า x
     ที่มีการประชุมที่ใช้งานอยู่ x x
patch() x

การตรวจสอบสิทธิ์และการให้สิทธิ์ด้วยข้อมูลเข้าสู่ระบบของผู้ใช้ช่วยให้แอป Google Meet เข้าถึงข้อมูลผู้ใช้และดำเนินการในนามของผู้ใช้ที่ผ่านการตรวจสอบสิทธิ์ได้ การตรวจสอบสิทธิ์ด้วยการมอบสิทธิ์ทั่วทั้งโดเมนช่วยให้คุณให้สิทธิ์บัญชีบริการของแอปพลิเคชันในการเข้าถึงข้อมูลของผู้ใช้โดยไม่ต้องขอความยินยอมจากผู้ใช้แต่ละคน

วิธีที่ Meet ระบุพื้นที่การประชุม

REST API ของ Google Meet จะสร้างแหล่งข้อมูล spaces สำหรับพื้นที่ทำงานแต่ละแห่ง ช่อง name คือชื่อทรัพยากรสำหรับแหล่งข้อมูล

ต่อไปนี้เป็น 2 วิธีสำคัญในการระบุพื้นที่การประชุมโดยใช้ช่อง name

  • space คือตัวระบุทรัพยากรของพื้นที่ทำงาน โดยอยู่ในรูปแบบ spaces/{space} ซึ่งเป็นรหัสที่ไม่ซ้ำกันซึ่งเซิร์ฟเวอร์สร้างขึ้นและคำนึงถึงตัวพิมพ์เล็กและตัวพิมพ์ใหญ่ เช่น spaces/jQCFfuBOdN5z

  • meetingCode เป็นชื่อแทนของพื้นที่ทำงาน โดยมีรูปแบบเป็น spaces/{meetingCode} โดยต้องเป็นสตริงอักขระที่ไม่ซ้ำกันซึ่งพิมพ์ได้ และไม่คำนึงถึงตัวพิมพ์เล็กและตัวพิมพ์ใหญ่ เช่น abc-mnop-xyz ความยาวสูงสุดคือ 128 อักขระ ซึ่งเป็นส่วนหนึ่งของmeetingUri ดังนี้ https://meet.google.com/abc-mnop-xyz

หากต้องการจัดการพื้นที่การประชุม ให้ใช้ค่าต่อไปนี้สำหรับช่อง {name}

  • หากต้องการดูรายละเอียดเกี่ยวกับพื้นที่จัดการประชุม คุณสามารถใช้ spaces/{space} หรืออีเมลแทน spaces/{meetingCode} โปรดดูข้อมูลเพิ่มเติมที่หัวข้อรับพื้นที่การประชุม

  • หากต้องการอัปเดตรายละเอียดของพื้นที่การประชุม คุณจะใช้ได้เฉพาะ spaces/{space} ดูข้อมูลเพิ่มเติมได้ที่อัปเดตพื้นที่การประชุม

  • หากต้องการปิดการประชุมที่ดำเนินอยู่ภายในพื้นที่การประชุม คุณจะใช้ได้เฉพาะ spaces/{space} ดูข้อมูลเพิ่มเติมได้ที่ปิดการประชุมที่ใช้งานอยู่

สร้างพื้นที่การประชุม

หากต้องการสร้างพื้นที่การประชุม ให้ใช้เมธอด create() ในแหล่งข้อมูล spaces

เมธอดจะแสดงผลอินสแตนซ์ของทรัพยากร spaces ซึ่งประกอบด้วยออบเจ็กต์ SpaceConfig ที่เป็นการกำหนดค่าสำหรับพื้นที่ในการประชุม รวมถึงออบเจ็กต์ ActiveConference ซึ่งเป็นลิงก์ไปยังทรัพยากร conferenceRecords ปัจจุบันภายในพื้นที่การประชุม

ตัวอย่างโค้ดต่อไปนี้แสดงวิธีสร้างพื้นที่การประชุม

Java

java-meet/samples/snippets/generated/com/google/apps/meet/v2/spacesservice/createspace/AsyncCreateSpace.java
import com.google.api.core.ApiFuture;
import com.google.apps.meet.v2.CreateSpaceRequest;
import com.google.apps.meet.v2.Space;
import com.google.apps.meet.v2.SpacesServiceClient;

public class AsyncCreateSpace {

  public static void main(String[] args) throws Exception {
    asyncCreateSpace();
  }

  public static void asyncCreateSpace() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
      CreateSpaceRequest request =
          CreateSpaceRequest.newBuilder().setSpace(Space.newBuilder().build()).build();
      ApiFuture<Space> future = spacesServiceClient.createSpaceCallable().futureCall(request);
      // Do something.
      Space response = future.get();
    }
  }
}

Node.js

packages/google-apps-meet/samples/generated/v2/spaces_service.create_space.js
/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Space to be created. As of May 2023, the input space can be empty. Later on
 *  the input space can be non-empty when space configuration is introduced.
 */
// const space = {}

// Imports the Meet library
const {SpacesServiceClient} = require('@google-apps/meet').v2;

// Instantiates a client
const meetClient = new SpacesServiceClient();

async function callCreateSpace() {
  // Construct request
  const request = {
  };

  // Run request
  const response = await meetClient.createSpace(request);
  console.log(response);
}

callCreateSpace();

Python

packages/google-apps-meet/samples/generated_samples/meet_v2_generated_spaces_service_create_space_async.py
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.apps import meet_v2


async def sample_create_space():
    # Create a client
    client = meet_v2.SpacesServiceAsyncClient()

    # Initialize request argument(s)
    request = meet_v2.CreateSpaceRequest(
    )

    # Make the request
    response = await client.create_space(request=request)

    # Handle the response
    print(response)

ดูรายละเอียดเกี่ยวกับพื้นที่การประชุม

หากต้องการดูรายละเอียดเกี่ยวกับพื้นที่ทำงานการประชุมที่ใช้งานอยู่และการตั้งค่า ให้ใช้เมธอด get() ในทรัพยากร spaces ที่มี name ที่ระบุ โปรดดูข้อมูลเพิ่มเติมที่หัวข้อวิธีที่ Meet ระบุพื้นที่การประชุม

เมธอดจะแสดงผลสถานที่ประชุมเป็นอินสแตนซ์ของทรัพยากร spaces

ตัวอย่างโค้ดต่อไปนี้แสดงวิธีเรียกข้อมูลพื้นที่การประชุม

Java

java-meet/samples/snippets/generated/com/google/apps/meet/v2/spacesservice/getspace/AsyncGetSpace.java
import com.google.api.core.ApiFuture;
import com.google.apps.meet.v2.GetSpaceRequest;
import com.google.apps.meet.v2.Space;
import com.google.apps.meet.v2.SpaceName;
import com.google.apps.meet.v2.SpacesServiceClient;

public class AsyncGetSpace {

  public static void main(String[] args) throws Exception {
    asyncGetSpace();
  }

  public static void asyncGetSpace() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
      GetSpaceRequest request =
          GetSpaceRequest.newBuilder().setName(SpaceName.of("[SPACE]").toString()).build();
      ApiFuture<Space> future = spacesServiceClient.getSpaceCallable().futureCall(request);
      // Do something.
      Space response = future.get();
    }
  }
}

Node.js

packages/google-apps-meet/samples/generated/v2/spaces_service.get_space.js
/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. Resource name of the space.
 *  Format: `spaces/{space}` or `spaces/{meetingCode}`.
 *  `{space}` is the resource identifier for the space. It's a unique,
 *  server-generated ID and is case sensitive. For example, `jQCFfuBOdN5z`.
 *  `{meetingCode}` is an alias for the space. It's a typeable, unique
 *  character string and is non-case sensitive. For example, `abc-mnop-xyz`.
 *  The maximum length is 128 characters.
 *  A `meetingCode` shouldn't be stored long term as it can become
 *  dissociated from a meeting space and can be reused for different meeting
 *  spaces in the future. Generally, a `meetingCode` expires 365 days after
 *  last use. For more information, see Learn about meeting codes in Google
 *  Meet (https://support.google.com/meet/answer/10710509).
 *  For more information, see How Meet identifies a meeting
 *  space (https://developers.google.com/meet/api/guides/meeting-spaces#identify-meeting-space).
 */
// const name = 'abc123'

// Imports the Meet library
const {SpacesServiceClient} = require('@google-apps/meet').v2;

// Instantiates a client
const meetClient = new SpacesServiceClient();

async function callGetSpace() {
  // Construct request
  const request = {
    name,
  };

  // Run request
  const response = await meetClient.getSpace(request);
  console.log(response);
}

callGetSpace();

Python

packages/google-apps-meet/samples/generated_samples/meet_v2_generated_spaces_service_get_space_async.py
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.apps import meet_v2


async def sample_get_space():
    # Create a client
    client = meet_v2.SpacesServiceAsyncClient()

    # Initialize request argument(s)
    request = meet_v2.GetSpaceRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_space(request=request)

    # Handle the response
    print(response)

แทนที่ค่าชื่อพื้นที่ทำงานด้วยรหัสที่ไม่ซ้ำกันซึ่งเซิร์ฟเวอร์สร้างขึ้นสำหรับพื้นที่ทำงานของการประชุม

อัปเดตพื้นที่สำหรับการประชุม

หากต้องการอัปเดตรายละเอียดของพื้นที่การประชุม ให้ใช้เมธอด patch() ในทรัพยากร spaces ที่มี name ที่ระบุ โปรดดูข้อมูลเพิ่มเติมที่หัวข้อวิธีที่ Meet ระบุพื้นที่การประชุม

นอกจากนี้ เมธอด patch() ยังใช้พารามิเตอร์การค้นหา updateMask ที่ไม่บังคับด้วย ฟิลด์เป็นประเภท FieldMask รายการช่องที่คั่นด้วยคอมมาซึ่งคุณต้องการอัปเดตในพื้นที่ทำงาน

เมธอดจะแสดงผลสถานที่ประชุมเป็นอินสแตนซ์ของทรัพยากร spaces

ตัวอย่างโค้ดต่อไปนี้แสดงวิธีอัปเดตพื้นที่การประชุม

Java

java-meet/samples/snippets/generated/com/google/apps/meet/v2/spacesservice/updatespace/AsyncUpdateSpace.java
import com.google.api.core.ApiFuture;
import com.google.apps.meet.v2.Space;
import com.google.apps.meet.v2.SpacesServiceClient;
import com.google.apps.meet.v2.UpdateSpaceRequest;
import com.google.protobuf.FieldMask;

public class AsyncUpdateSpace {

  public static void main(String[] args) throws Exception {
    asyncUpdateSpace();
  }

  public static void asyncUpdateSpace() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
      UpdateSpaceRequest request =
          UpdateSpaceRequest.newBuilder()
              .setSpace(Space.newBuilder().build())
              .setUpdateMask(FieldMask.newBuilder().build())
              .build();
      ApiFuture<Space> future = spacesServiceClient.updateSpaceCallable().futureCall(request);
      // Do something.
      Space response = future.get();
    }
  }
}

Node.js

packages/google-apps-meet/samples/generated/v2/spaces_service.update_space.js
/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. Space to be updated.
 */
// const space = {}
/**
 *  Optional. Field mask used to specify the fields to be updated in the space.
 *  If update_mask isn't provided(not set, set with empty paths, or only has ""
 *  as paths), it defaults to update all fields provided with values in the
 *  request.
 *  Using "*" as update_mask will update all fields, including deleting fields
 *  not set in the request.
 */
// const updateMask = {}

// Imports the Meet library
const {SpacesServiceClient} = require('@google-apps/meet').v2;

// Instantiates a client
const meetClient = new SpacesServiceClient();

async function callUpdateSpace() {
  // Construct request
  const request = {
    space,
  };

  // Run request
  const response = await meetClient.updateSpace(request);
  console.log(response);
}

callUpdateSpace();

Python

packages/google-apps-meet/samples/generated_samples/meet_v2_generated_spaces_service_update_space_async.py
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.apps import meet_v2


async def sample_update_space():
    # Create a client
    client = meet_v2.SpacesServiceAsyncClient()

    # Initialize request argument(s)
    request = meet_v2.UpdateSpaceRequest(
    )

    # Make the request
    response = await client.update_space(request=request)

    # Handle the response
    print(response)

แทนที่ค่าชื่อพื้นที่ทำงานด้วยรหัสที่ไม่ซ้ำกันซึ่งเซิร์ฟเวอร์สร้างขึ้นสำหรับพื้นที่ทำงานของการประชุม

สิ้นสุดการประชุมที่ใช้งานอยู่

หากต้องการสิ้นสุดการประชุมที่ใช้งานอยู่ภายในพื้นที่การประชุม (หากมี) ให้ใช้วิธีในแหล่งข้อมูล spaces ของ endActiveConference() ทั้งเนื้อหาคำขอและคำตอบว่างเปล่า โปรดดูข้อมูลเพิ่มเติมที่หัวข้อวิธีที่ Meet ระบุพื้นที่การประชุม

ตัวอย่างโค้ดต่อไปนี้แสดงวิธีปิดการประชุมที่ใช้งานอยู่

Java

java-meet/samples/snippets/generated/com/google/apps/meet/v2/spacesservice/endactiveconference/AsyncEndActiveConference.java
import com.google.api.core.ApiFuture;
import com.google.apps.meet.v2.EndActiveConferenceRequest;
import com.google.apps.meet.v2.SpaceName;
import com.google.apps.meet.v2.SpacesServiceClient;
import com.google.protobuf.Empty;

public class AsyncEndActiveConference {

  public static void main(String[] args) throws Exception {
    asyncEndActiveConference();
  }

  public static void asyncEndActiveConference() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
      EndActiveConferenceRequest request =
          EndActiveConferenceRequest.newBuilder()
              .setName(SpaceName.of("[SPACE]").toString())
              .build();
      ApiFuture<Empty> future =
          spacesServiceClient.endActiveConferenceCallable().futureCall(request);
      // Do something.
      future.get();
    }
  }
}

Node.js

packages/google-apps-meet/samples/generated/v2/spaces_service.end_active_conference.js
/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. Resource name of the space.
 *  Format: `spaces/{space}`.
 *  `{space}` is the resource identifier for the space. It's a unique,
 *  server-generated ID and is case sensitive. For example, `jQCFfuBOdN5z`.
 *  For more information, see How Meet identifies a meeting
 *  space (https://developers.google.com/meet/api/guides/meeting-spaces#identify-meeting-space).
 */
// const name = 'abc123'

// Imports the Meet library
const {SpacesServiceClient} = require('@google-apps/meet').v2;

// Instantiates a client
const meetClient = new SpacesServiceClient();

async function callEndActiveConference() {
  // Construct request
  const request = {
    name,
  };

  // Run request
  const response = await meetClient.endActiveConference(request);
  console.log(response);
}

callEndActiveConference();

Python

packages/google-apps-meet/samples/generated_samples/meet_v2_generated_spaces_service_end_active_conference_async.py
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.apps import meet_v2


async def sample_end_active_conference():
    # Create a client
    client = meet_v2.SpacesServiceAsyncClient()

    # Initialize request argument(s)
    request = meet_v2.EndActiveConferenceRequest(
        name="name_value",
    )

    # Make the request
    await client.end_active_conference(request=request)

แทนที่ค่าชื่อพื้นที่ทำงานด้วยรหัสที่ไม่ซ้ำกันซึ่งเซิร์ฟเวอร์สร้างขึ้นสำหรับพื้นที่ทำงานของการประชุม