> ## Documentation Index
> Fetch the complete documentation index at: https://help.dingtalk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create, update, query, and delete a meeting room

> A complete walkthrough for using an internal app to call the smart meeting room APIs to create, update, query, and delete rooms, covering credential acquisition and API permission setup.

This document shows how to create an internal app and use the APIs provided by Smart meeting room to create, update, query, and delete meeting rooms.

## Expected result

The meeting room is displayed as follows:

## Process overview

Prerequisite: Complete the [App creation and configuration](/open/dingstart/create-application) process.

Step 1: Obtain the app credential information, including the client ID and Client Secret.

Step 2: Request the API permissions for Smart meeting room.

Step 3: Obtain the app access credential by following [Obtain the access token of an internal app](/open/development/obtain-the-access-token-of-an-internal-app). The access token is used to authenticate the caller when calling APIs.

Step 4: Call the meeting room APIs:

1. Call the Server API [Create a meeting room](/open/development/create-a-meeting-room). The `result` field returned by the API is the meeting room ID.
2. With the meeting room ID, call the Server API [Update meeting room information](/open/development/update-meeting-room-information) to update the meeting room information.
3. Call the Server API [Query the meeting room list](/open/development/check-the-meeting-room-list) to retrieve the list of meeting rooms.
4. With the meeting room ID, call the Server API [Query meeting room details](/open/development/check-meeting-room-details) to retrieve the details of a specific meeting room.
5. With the meeting room ID, call the Server API [Delete a meeting room](/open/development/delete-a-meeting-room) to delete a meeting room.

## Prerequisite

Complete the [App creation and configuration](/open/dingstart/create-application) process.

## Step 1: Obtain the app credential

1. Select the target app and go to the app details page. Click **Basic information** > **Credentials and basic information**.
2. Obtain the client ID and Client Secret.

## Step 2: Add API permissions

Click **Development configuration** > **Manage permissions**. In the permission search box, enter `VideoConference.Conference.Write` and `VideoConference.Conference.Read` respectively, and request the permissions.

## Step 3: Obtain the access token

<Warning>
  For details about the differences between Server API versions, see the comparison between the legacy and new APIs. The following endpoints all use Server APIs. For details about SDK downloads, see Server-side SDK downloads.
</Warning>

Using the client ID and Client Secret from Step 1, obtain the app access credential by following [Obtain the access token of an internal app](/open/development/obtain-the-access-token-of-an-internal-app).

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
 public void getAccessToken() throws Exception {
        Config config = new Config();
        config.protocol = "https";
        config.regionId = "central";
        com.aliyun.dingtalkoauth2_1_0.Client client = new com.aliyun.dingtalkoauth2_1_0.Client(config);
        GetAccessTokenRequest accessTokenRequest = new GetAccessTokenRequest()
                .setAppKey("din*********hgn")
                .setAppSecret("9G_O************mBkhgGIO");
        GetAccessTokenResponse accessToken = client.getAccessToken(accessTokenRequest);
        System.out.println(JSON.toJSONString(accessToken.getBody()));
    }
```

## Step 4: Call the meeting room APIs

1. Call the Server API [Create a meeting room](/open/development/create-a-meeting-room). The `result` field returned by the API is the meeting room ID.

   ```java lines theme={"theme":{"light":"github-light","dark":"github-dark"}}
   public void createMeetingRoom() throws Exception {
           com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config();
           config.protocol = "https";
           config.regionId = "central";
           com.aliyun.dingtalkrooms_1_0.Client client = new com.aliyun.dingtalkrooms_1_0.Client(config);
           com.aliyun.dingtalkrooms_1_0.models.CreateMeetingRoomHeaders createMeetingRoomHeaders = new com.aliyun.dingtalkrooms_1_0.models.CreateMeetingRoomHeaders();
           createMeetingRoomHeaders.xAcsDingtalkAccessToken = "acccessToken";
           com.aliyun.dingtalkrooms_1_0.models.CreateMeetingRoomRequest.CreateMeetingRoomRequestRoomLocation roomLocation = new com.aliyun.dingtalkrooms_1_0.models.CreateMeetingRoomRequest.CreateMeetingRoomRequestRoomLocation()
                   .setTitle("***Test")
                   .setDesc("No. xx, xx Road, xx District, xx City");
           com.aliyun.dingtalkrooms_1_0.models.CreateMeetingRoomRequest createMeetingRoomRequest = new com.aliyun.dingtalkrooms_1_0.models.CreateMeetingRoomRequest()
                   .setUnionId("E9CS6X*******eN7QiEiE")
                   .setRoomName("Test meeting room")
                   .setRoomCapacity(10)
                   .setRoomPicture("https://example/k/DingTalkImage1.png")
                   .setRoomStatus(0)
                   .setRoomLocation(roomLocation)
                   .setRoomLabelIds(java.util.Arrays.asList(
                           1L
                   ))
                   .setIsvRoomId("dingTalk1001");
           try {
               CreateMeetingRoomResponse meetingRoomWithOptions = client.createMeetingRoomWithOptions(createMeetingRoomRequest, createMeetingRoomHeaders, new RuntimeOptions());
               System.out.println(JSON.toJSONString(meetingRoomWithOptions.getBody()));
           } catch (TeaException err) {
               if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                   // err contains code and message attributes, which help locate the issue
                   System.out.println(err.code);
                   System.out.println(err.message);
               }
           } catch (Exception _err) {
               TeaException err = new TeaException(_err.getMessage(), _err);
               if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                   // err contains code and message attributes, which help locate the issue
                   System.out.println(err.code);
                   System.out.println(err.message);
               }
           }
       }
   ```
2. With the meeting room ID, call the Server API [Update meeting room information](/open/development/update-meeting-room-information) to update the meeting room information.

   ```java lines theme={"theme":{"light":"github-light","dark":"github-dark"}}
   public void  updateMeetingRooms() throws Exception {
           com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config();
           config.protocol = "https";
           config.regionId = "central";
           com.aliyun.dingtalkrooms_1_0.Client client = new com.aliyun.dingtalkrooms_1_0.Client(config);
           com.aliyun.dingtalkrooms_1_0.models.UpdateMeetingRoomHeaders updateMeetingRoomHeaders = new com.aliyun.dingtalkrooms_1_0.models.UpdateMeetingRoomHeaders();
           updateMeetingRoomHeaders.xAcsDingtalkAccessToken = "acccessToken";
           com.aliyun.dingtalkrooms_1_0.models.UpdateMeetingRoomRequest.UpdateMeetingRoomRequestRoomLocation roomLocation = new com.aliyun.dingtalkrooms_1_0.models.UpdateMeetingRoomRequest.UpdateMeetingRoomRequestRoomLocation()
                   .setTitle("Alibaba***Tower A")
                   .setDesc("**District, **City");
           com.aliyun.dingtalkrooms_1_0.models.UpdateMeetingRoomRequest updateMeetingRoomRequest = new com.aliyun.dingtalkrooms_1_0.models.UpdateMeetingRoomRequest()
                   .setUnionId("E9CS6X*******eN7QiEiE")
                   .setRoomId("9d5356997e44f******0ab267c05d6b3a14")
                   .setRoomName("Meeting room test")
                   .setRoomCapacity(10)
                   .setRoomPicture("https://example/k/DingTalkImage1.png")
                   .setRoomStatus(0)
                   .setRoomLocation(roomLocation)
                   .setRoomLabelIds(java.util.Arrays.asList(
                           1L
                   ))
                   .setIsvRoomId("dingTalk1001");
           try {
               UpdateMeetingRoomResponse updateMeetingRoomResponse = client.updateMeetingRoomWithOptions(updateMeetingRoomRequest, updateMeetingRoomHeaders, new RuntimeOptions());
               System.out.println(JSON.toJSONString(updateMeetingRoomResponse.getBody()));
           } catch (TeaException err) {
               if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                   // err contains code and message attributes, which help locate the issue
                   System.out.println(err.code);
                   System.out.println(err.message);
               }
           } catch (Exception _err) {
               TeaException err = new TeaException(_err.getMessage(), _err);
               if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                   // err contains code and message attributes, which help locate the issue
                   System.out.println(err.code);
                   System.out.println(err.message);
               }
           }
       }
   ```
3. Call the Server API [Query the meeting room list](/open/development/check-the-meeting-room-list) to retrieve the list of meeting rooms.

   ```java lines theme={"theme":{"light":"github-light","dark":"github-dark"}}
   public void meetingRoomsList() throws Exception {
           com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config();
           config.protocol = "https";
           config.regionId = "central";
           com.aliyun.dingtalkrooms_1_0.Client client = new com.aliyun.dingtalkrooms_1_0.Client(config);
           com.aliyun.dingtalkrooms_1_0.models.QueryMeetingRoomListHeaders queryMeetingRoomListHeaders = new com.aliyun.dingtalkrooms_1_0.models.QueryMeetingRoomListHeaders();
           queryMeetingRoomListHeaders.xAcsDingtalkAccessToken = "acccessToken";
           com.aliyun.dingtalkrooms_1_0.models.QueryMeetingRoomListRequest queryMeetingRoomListRequest = new com.aliyun.dingtalkrooms_1_0.models.QueryMeetingRoomListRequest()
                   .setMaxResults(20)
                   .setUnionId("E9CS6X*******eN7QiEiE");
           try {
               QueryMeetingRoomListResponse queryMeetingRoomListResponse = client.queryMeetingRoomListWithOptions(queryMeetingRoomListRequest, queryMeetingRoomListHeaders, new RuntimeOptions());
               System.out.println(JSON.toJSONString(queryMeetingRoomListResponse.getBody()));
           } catch (TeaException err) {
               if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                   // err contains code and message attributes, which help locate the issue
                   System.out.println(err.code);
                   System.out.println(err.message);
               }
           } catch (Exception _err) {
               TeaException err = new TeaException(_err.getMessage(), _err);
               if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                   // err contains code and message attributes, which help locate the issue
                   System.out.println(err.code);
                   System.out.println(err.message);
               }
           }
       }
   ```
4. With the meeting room ID, call the Server API [Query meeting room details](/open/development/check-meeting-room-details) to retrieve the details of a specific meeting room.

   ```java lines theme={"theme":{"light":"github-light","dark":"github-dark"}}
    public void  meetingRoomsInfo() throws Exception {
           com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config();
           config.protocol = "https";
           config.regionId = "central";
           com.aliyun.dingtalkrooms_1_0.Client client = new com.aliyun.dingtalkrooms_1_0.Client(config);
           com.aliyun.dingtalkrooms_1_0.models.QueryMeetingRoomHeaders queryMeetingRoomHeaders = new com.aliyun.dingtalkrooms_1_0.models.QueryMeetingRoomHeaders();
           queryMeetingRoomHeaders.xAcsDingtalkAccessToken = "acccessToken";
           com.aliyun.dingtalkrooms_1_0.models.QueryMeetingRoomRequest queryMeetingRoomRequest = new com.aliyun.dingtalkrooms_1_0.models.QueryMeetingRoomRequest()
                   .setUnionId("E9CS6X*******eN7QiEiE");
           try {
               QueryMeetingRoomResponse queryMeetingRoomResponse = client.queryMeetingRoomWithOptions("9d5356997e44f******0ab267c05d6b3a14", queryMeetingRoomRequest, queryMeetingRoomHeaders, new RuntimeOptions());
               System.out.println(JSON.toJSONString(queryMeetingRoomResponse.getBody()));
           } catch (TeaException err) {
               if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                   // err contains code and message attributes, which help locate the issue
                   System.out.println(err.code);
                   System.out.println(err.message);
               }
           } catch (Exception _err) {
               TeaException err = new TeaException(_err.getMessage(), _err);
               if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                   // err contains code and message attributes, which help locate the issue
                   System.out.println(err.code);
                   System.out.println(err.message);
               }
           }
       }
   ```
5. With the meeting room ID, call the Server API [Delete a meeting room](/open/development/delete-a-meeting-room) to delete a meeting room.

### Note

Deleting a meeting room requires the Smart meeting room App Management permission.

```java lines theme={"theme":{"light":"github-light","dark":"github-dark"}}
 public void  deleteMeetingRoom() throws Exception {
        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config();
        config.protocol = "https";
        config.regionId = "central";
        com.aliyun.dingtalkrooms_1_0.Client client = new com.aliyun.dingtalkrooms_1_0.Client(config);
        com.aliyun.dingtalkrooms_1_0.models.DeleteMeetingRoomHeaders deleteMeetingRoomHeaders = new com.aliyun.dingtalkrooms_1_0.models.DeleteMeetingRoomHeaders();
        deleteMeetingRoomHeaders.xAcsDingtalkAccessToken = "acccessToken";
        com.aliyun.dingtalkrooms_1_0.models.DeleteMeetingRoomRequest deleteMeetingRoomRequest = new com.aliyun.dingtalkrooms_1_0.models.DeleteMeetingRoomRequest()
                .setUnionId("E9CS6X*******eN7QiEiE");
        try {
            DeleteMeetingRoomResponse deleteMeetingRoomResponse = client.deleteMeetingRoomWithOptions("9d5356997e44f******0ab267c05d6b3a14", deleteMeetingRoomRequest, deleteMeetingRoomHeaders, new RuntimeOptions());
            System.out.println(JSON.toJSONString(deleteMeetingRoomResponse.getBody()));
        } catch (TeaException err) {
            if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                // err contains code and message attributes, which help locate the issue
                System.out.println(err.code);
                System.out.println(err.message);
            }
        } catch (Exception _err) {
            TeaException err = new TeaException(_err.getMessage(), _err);
            if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                // err contains code and message attributes, which help locate the issue
                System.out.println(err.code);
                System.out.println(err.message);
            }
        }
    }
```
