Classroom REST API
This page provides detailed help for the Flexible Classroom RESTful APIs.
Basic information
Server
All requests are sent to the host: api.agora.io.
Data format
The Content-Type of all requests is application/json.
Authentication
Flexible Classroom Cloud Service uses tokens for authentication. You need to put the following information to the x-agora-token
and x-agora-uid
fields when sending your HTTP request:
- The RTM Token generated at your server.
- The uid you use to generate the RTM Token.
For details, see Generate an RTM Token.
Kick a user out of a classroom
Description
Call this method to kick a specified user out of a classroom. After a successful method call, the server triggers an event indicating a user leaves the classroom. You can use the dirty
parameter to determine whether the user can enter the classroom afterwards.
Prototype
- Method: POST
- Endpoint: /{region}/edu/apps/{appId}/v2/rooms/{roomUUid}/users/{userUuid}/exit
Request parameters
URL parameters
Pass the following parameters in the URL.
Parameter | Type | Description |
---|---|---|
region | String | (Required) The region for connection. For details, see Network geofencing. Flexible Classroom supports the following regions:cn : Mainland China.ap : Asia Pacific.eu : Europe.na : North America. |
appId | String | (Required) Agora App ID. |
roomUuid | String | (Required) The classroom ID. This is the globally unique identifier of a classroom. It is also used as the channel name when a user joins an RTC or RTM channel. The string length must be less than 64 bytes. Supported character scopes are: |
userUuid | String | (Required) The user ID. This is the unique identifier of the user and also the user ID used when logging in to the Agora RTM system. The string length must be less than 64 bytes. Supported character scopes are: |
Request body parameters
Pass in the following parameters in the request body.
Parameter | Type | Description |
---|---|---|
dirty | Object | (Optional) The user privilege:
|
Request example
Request URL
Request Body
Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | Business status code: |
msg | String | The detailed information. |
ts | Number | The current Unix timestamp (in milliseconds) of the server in UTC. |
Response example
Set the classroom state
Description
Call this method to set the classroom state: Not started, Started, Ended.
Prototype
- Method: PUT
- Endpoint: /{region}/edu/apps/{appId}/v2/rooms/{roomUUid}/states/{state}
Request parameters
URL parameters
Pass the following parameter in the URL.
Parameter | Type | Description |
---|---|---|
region | String | (Required) The region for connection. For details, see Network geofencing. Flexible Classroom supports the following regions:cn : Mainland China.ap : Asia Pacific.eu : Europe.na : North America. |
appId | String | (Required) Agora App ID. |
roomUuid | String | (Required) The classroom ID. This is the globally unique identifier of a classroom. It is also used as the channel name when a user joins an RTC or RTM channel. The string length must be less than 64 bytes. Supported character scopes are: |
state | Integer | (Required) The classroom state:0 : Not started.1 : Started.2 : Ended.3 : The room is closed and users can no longer join the room. |
Request example
Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | Business status code: |
msg | String | The detailed information. |
ts | Number | The current Unix timestamp (in milliseconds) of the server in UTC. |
Response example
Set the recording state
Description
Call this method to start or stop recording a specified classroom.
Prototype
- Method: PUT
- Endpoint: /{region}/edu/apps/{appId}/v2/rooms/{roomUUid}/records/states/{state}
Request parameters
URL parameters
Pass the following parameter in the URL.
Parameter | Type | Description |
---|---|---|
region | String | (Required) The region for connection. For details, see Network geofencing. Flexible Classroom supports the following regions:cn : Mainland China.ap : Asia Pacific.eu : Europe.na : North America. |
appId | String | (Required) Agora App ID. |
roomUuid | String | (Required) The classroom ID. This is the globally unique identifier of a classroom. It is also used as the channel name when a user joins an RTC or RTM channel. The string length must be less than 64 bytes. Supported character scopes are: |
state | Integer | (Required) The recording state:0 : Stop recoding.1 : Started. |
Request body parameters
Pass in the following parameters in the request body.
Parameter | Type | Description |
---|---|---|
mode | String | (Optional) The recording mode:web to enable web page recording mode. The format of recorded files is MP4. When the length of the recorded file reaches around two hours, or when the size of the file exceeds around 2 GB, the recording service automatically creates another MP4 file. |
webRecordConfig | Object | (Optional) When the mode is set as web , you need to set the detailed configuration of the web page recording through webRecordConfig , including the following fields:
|
retryTimeout | Number | The amount of time (seconds) that the Flexible Classroom cloud service waits between tries. The Flexible Classroom cloud service reties twice at most. |
Request example
Request URL
Request Body
Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | Business status code: |
msg | String | The detailed information. |
ts | Number | The current Unix timestamp (in milliseconds) of the server in UTC. |
Response example
Update the recording configurations
Description
Call this method during the recording to update the recording configurations. Every time this method is called, the previous configurations are overwritten.
Prototype
- Method: PUT
- Endpoint: /{region}/edu/apps/{appId}/v2/rooms/{roomUUid}/records/states/{state}
Request parameters
URL parameters
Pass the following parameter in the URL.
Parameter | Type | Description |
---|---|---|
region | String | (Required) The region for connection. For details, see Network geofencing. Flexible Classroom supports the following regions:cn : Mainland China.ap : Asia Pacific.eu : Europe.na : North America. |
appId | String | (Required) Agora App ID. |
roomUuid | String | (Required) The classroom ID. This is the globally unique identifier of a classroom. It is also used as the channel name when a user joins an RTC or RTM channel. The string length must be less than 64 bytes. Supported character scopes are: |
Request body parameters
Pass in the following parameters in the request body.
Parameter | Type | Description |
---|---|---|
webRecordConfig | Object | (Optional) Recording configurations:
|
Request example
Request URL
Request Body
Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | Business status code: |
msg | String | The detailed information. |
ts | Number | The current Unix timestamp (in milliseconds) of the server in UTC. |
Response example
Get the recording list
Description
Get the recording list in a specified classroom.
You can fetch data in batches with the nextId
parameter. You can get up to 100 pieces of data for each batch.
Prototype
- Method: GET
- Endpoint: /{region}/edu/apps/{appId}/v2/rooms/{roomUUid}/records
Request parameters
URL parameters
Pass the following parameter in the URL.
Parameter | Type | Description |
---|---|---|
region | String | (Required) The region for connection. For details, see Network geofencing. Flexible Classroom supports the following regions:cn : Mainland China.ap : Asia Pacific.eu : Europe.na : North America. |
appId | String | (Required) Agora App ID. |
roomUuid | String | (Required) The classroom ID. This is the globally unique identifier of a classroom. It is also used as the channel name when a user joins an RTC or RTM channel. The string length must be less than 64 bytes. Supported character scopes are: |
Query parameters
Parameter | Type | Description |
---|---|---|
nextId | String | (Optional) The starting ID of the next batch of data. When you call this method to get the data for the first time, leave this parameter empty or set it as null. Afterward, you can set this parameter as the nextId that you get in the response of the previous method call. |
Request example
Example one:
Example two:
Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | Business status code: |
msg | String | The detailed information. |
ts | Number | The current Unix timestamp (in milliseconds) of the server in UTC. |
data | Object | Include the following parameters:
|
Response example
Upload a public resource
Description
Call this method to upload a public resource to the specified classroom. All users in the classroom can see these public resources.
Prototype
- Method: PUT
- Endpoint: /{region}/edu/apps/{appId}/v1/rooms/{roomUUid}/resources/{resourceUuid}
Request parameters
URL parameters
Pass the following parameters in the URL.
Parameter | Type | Description |
---|---|---|
region | String | (Required) The region for connection. For details, see Network geofencing. Flexible Classroom supports the following regions:cn : Mainland China.ap : Asia Pacific.eu : Europe.na : North America. |
appId | String | (Required) Agora App ID. |
roomUuid | String | (Required) The classroom ID. This is the globally unique identifier of a classroom. It is also used as the channel name when a user joins an RTC or RTM channel. The string length must be less than 64 bytes. Supported character scopes are: |
resourceUuid | String | (Required) The resource ID. This is the unique identifier of a file. The string length must be less than 64 bytes. Supported character scopes are: |
Request body parameters
Pass in the following parameters in the request body.
Parameter | Type | Description |
---|---|---|
resourceName | String | The resource name for display in the classroom. The string length must be less than 64 bytes. |
size | Number | (Required) The size (bytes) of the resource. |
ext | String | (Required) The resource extension:
|
url | String | (Required) The URL address of the resource, such as "https://xxx.com" . |
conversion | Object | (Optional) If you want to display resources such as a PPT on the whiteboard in the classroom, you need to set conversion to convert the resource into a static image or a dynamic HTML page. conversion contains the following fields:
|
Request example
Request URL
Request Body
Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | Business status code: |
msg | String | The detailed information. |
ts | Number | The current Unix timestamp (in milliseconds) of the server in UTC. |
data | Object Array | An array of republic resources. Each object represents a public resource and contains the following fields:
|
Response example
Delete public resources
Description
Delete one or multiple public resources in the specified classroom.
Prototype
- Method: DELETE
- Endpoint: /{region}/edu/apps/{appId}/v1/rooms/{roomUUid}/resources
Request parameters
URL parameters
Pass the following parameters in the URL.
Parameter | Type | Description |
---|---|---|
region | String | (Required) The region for connection. For details, see Network geofencing. Flexible Classroom supports the following regions:cn : Mainland China.ap : Asia Pacific.eu : Europe.na : North America. |
appId | String | (Required) Agora App ID. |
roomUuid | String | (Required) The classroom ID. This is the globally unique identifier of a classroom. It is also used as the channel name when a user joins an RTC or RTM channel. The string length must be less than 64 bytes. Supported character scopes are: |
Request body parameters
Pass in the following parameters in the request body.
Parameter | Type | Description |
---|---|---|
resourceUuids | String array | (Required) An array of resource IDs. The resource ID is the unique identifier of a resource. The string length must be less than 64 bytes. Supported character scopes are: |
Request example
Request URL
Request Body
Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | Business status code: |
msg | String | The detailed information. |
ts | Number | The current Unix timestamp (in milliseconds) of the server in UTC. |
Response example
Get public resources
Description
Get all public resources in the specified classroom.
Prototype
- Method: GET
- Endpoint: /{region}/edu/apps/{appId}/v1/rooms/{roomUUid}/resources
Request parameters
URL parameters
Pass the following parameters in the URL.
Parameter | Type | Description |
---|---|---|
region | String | (Required) The region for connection. For details, see Network geofencing. Flexible Classroom supports the following regions:cn : Mainland China.ap : Asia Pacific.eu : Europe.na : North America. |
appId | String | (Required) Agora App ID. |
roomUuid | String | (Required) The classroom ID. This is the globally unique identifier of a classroom. It is also used as the channel name when a user joins an RTC or RTM channel. The string length must be less than 64 bytes. Supported character scopes are: |
Request example
Request URL
Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | Business status code: |
msg | String | The detailed information. |
ts | Number | The current Unix timestamp (in milliseconds) of the server in UTC. |
data | Object Array | An array of republic resources. Each object represents a public resource and contains the following fields:
|
Response example
Query a specified event
Description
Query a specified type of event in a specified classroom.
You can fetch data in batches with the nextId
parameter. You can get up to 100 pieces of data for each batch.
Prototype
- Method: GET
- Endpoint: /{region}/edu/apps/{appId}/v2/rooms/{roomUUid}/sequences
Request parameters
URL parameters
Pass the following parameters in the URL.
Parameter | Type | Description |
---|---|---|
region | String | (Required) The region for connection. For details, see Network geofencing. Flexible Classroom supports the following regions:cn : Mainland China.ap : Asia Pacific.eu : Europe.na : North America. |
appId | String | (Required) Agora App ID. |
roomUuid | String | (Required) The classroom ID. This is the globally unique identifier of a classroom. It is also used as the channel name when a user joins an RTC or RTM channel. The string length must be less than 64 bytes. Supported character scopes are: |
Query parameters
Parameter | Type | Description |
---|---|---|
nextId | String | (Optional) The starting ID of the next batch of data. When you call this method to get the data for the first time, leave this parameter empty or set it as null. Afterward, you can set this parameter as the nextId that you get in the response of the previous method call. |
cmd | Integer | (Optional) Event type. For details, see Flexible Classroom Cloud Service Events. |
Request example
Request URL
Example one:
Example two:
Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | Business status code: |
msg | String | The detailed information. |
ts | Number | The current Unix timestamp (in milliseconds) of the server in UTC. |
data | Object | Include the following parameters:
|
Response example
Get classroom events
Description
Get all events in the classrooms associated with a specified App ID.
You can call this method at regular intervals to listen for all the events that occur in the flexible classrooms.
Prototype
- Method: GET
- Endpoint: /{region}/edu/polling/apps/{appId}/v2/rooms/sequences
Request parameters
URL parameters
Pass the following parameter in the URL.
Parameter | Type | Description |
---|---|---|
region | String | (Required) The region for connection. For details, see Network geofencing. Flexible Classroom supports the following regions:cn : Mainland China.ap : Asia Pacific.eu : Europe.na : North America. |
appId | String | (Required) Agora App ID. |
Request example
Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | Business status code: |
msg | String | The detailed information. |
ts | Number | The current Unix timestamp (in milliseconds) of the server in UTC. |
data | Object | Include the following parameters:roomUuid : String, the classroom ID.cmd : Integer, the event type. For details, see Flexible Classroom Cloud Service Events.sequence : Integer. The event ID. This is the unique identifier of an event, which is automatically generated to ensure the order of events.version : Integer, the service version.data : Object, the detailed data of the event. The data varies depending on the event type. For details, see Flexible Classroom Cloud Service Events. |
Response example
Update custom classroom properties
Description
Add or update the custom properties of a specified classroom.
Prototype
- Method: PUT
- Endpoint: /{region}/edu/apps/{appId}/v2/rooms/{roomUUid}/properties
Request parameters
URL parameters
Pass the following parameters in the URL.
Parameter | Type | Description |
---|---|---|
region | String | (Required) The region for connection. For details, see Network geofencing. Flexible Classroom supports the following regions:cn : Mainland China.ap : Asia Pacific.eu : Europe.na : North America. |
appId | String | (Required) Agora App ID. |
roomUuid | String | (Required) The classroom ID. This is the globally unique identifier of a classroom. It is also used as the channel name when a user joins an RTC or RTM channel. The string length must be less than 64 bytes. Supported character scopes are: |
Request body parameters
Pass in the following parameters in the request body.
Parameter | Type | Description |
---|---|---|
properties | Object | Classroom properties. |
cause | Object | The update reason. |
Request example
Request Body
Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | Business status code: |
msg | String | The detailed information. |
ts | Number | The current Unix timestamp (in milliseconds) of the server in UTC. |
Response example
Delete custom classroom properties
Description
Delete the custom properties of a specified classroom.
Prototype
- Method: DELETE
- Endpoint: /{region}/edu/apps/{appId}/v2/rooms/{roomUUid}/properties
Request parameters
URL parameters
Pass the following parameters in the URL.
Parameter | Type | Description |
---|---|---|
region | String | (Required) The region for connection. For details, see Network geofencing. Flexible Classroom supports the following regions:cn : Mainland China.ap : Asia Pacific.eu : Europe.na : North America. |
appId | String | (Required) Agora App ID. |
roomUuid | String | (Required) The classroom ID. This is the globally unique identifier of a classroom. It is also used as the channel name when a user joins an RTC or RTM channel. The string length must be less than 64 bytes. Supported character scopes are: |
Request body parameters
Pass in the following parameters in the request body.
Parameter | Type | Description |
---|---|---|
properties | String array | Classroom properties. |
cause | Object | Reason for deletion. |
Request example
Request Body
Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | Business status code: |
msg | String | The detailed information. |
ts | Number | The current Unix timestamp (in milliseconds) of the server in UTC. |
Response example
Update custom user properties
Description
Add or update the custom properties of a specified user.
Prototype
- Method: PUT
- Endpoint: /{region}/edu/apps/{appId}/v2/rooms/{roomUUid}/users/{userUuid}/properties
Request parameters
URL parameters
Pass the following parameters in the URL.
Parameter | Type | Description |
---|---|---|
region | String | (Required) The region for connection. For details, see Network geofencing. Flexible Classroom supports the following regions:cn : Mainland China.ap : Asia Pacific.eu : Europe.na : North America. |
appId | String | (Required) Agora App ID. |
roomUuid | String | (Required) The classroom ID. This is the globally unique identifier of a classroom. It is also used as the channel name when a user joins an RTC or RTM channel. The string length must be less than 64 bytes. Supported character scopes are: |
userUuid | String | (Required) The user ID. This is the unique identifier of the user and also the user ID used when logging in to the Agora RTM system. The string length must be less than 64 bytes. Supported character scopes are: |
Request body parameters
Pass in the following parameters in the request body.
Parameter | Type | Description |
---|---|---|
properties | Object | The user properties. |
cause | Object | The update reason. |
Request example
Request Body
Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | Business status code: |
msg | String | The detailed information. |
ts | Number | The current Unix timestamp (in milliseconds) of the server in UTC. |
Response example
Delete custom user properties
Description
Delete the custom properties of a specified user.
Prototype
- Method: DELETE
- Endpoint: /{region}/edu/apps/{appId}/v2/rooms/{roomUUid}/users/{userUuid}/properties
Request parameters
URL parameters
Pass the following parameters in the URL.
Parameter | Type | Description |
---|---|---|
region | String | (Required) The region for connection. For details, see Network geofencing. Flexible Classroom supports the following regions:cn : Mainland China.ap : Asia Pacific.eu : Europe.na : North America. |
appId | String | (Required) Agora App ID. |
roomUuid | String | (Required) The classroom ID. This is the globally unique identifier of a classroom. It is also used as the channel name when a user joins an RTC or RTM channel. The string length must be less than 64 bytes. Supported character scopes are: |
userUuid | String | (Required) The user ID. This is the unique identifier of the user and also the user ID used when logging in to the Agora RTM system. The string length must be less than 64 bytes. Supported character scopes are: |
Request body parameters
Pass in the following parameters in the request body.
Parameter | Type | Description |
---|---|---|
properties | String array | The user properties. |
cause | Object | Reason for deletion. |
Request example
Request Body
Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | Business status code: |
msg | String | The detailed information. |
ts | Number | The current Unix timestamp (in milliseconds) of the server in UTC. |
Response example
Set the extApp properties
Description
Add or update the properties of the extApp in a specified classroom.
Prototype
- Method: PUT
- Endpoint: /{region}/edu/apps/{appId}/v2/rooms/{roomUUid}/extApps/{extAppUuid}/properties
Request parameters
URL parameters
Pass the following parameters in the URL.
Parameter | Type | Description |
---|---|---|
region | String | (Required) The region for connection. For details, see Network geofencing. Flexible Classroom supports the following regions:cn : Mainland China.ap : Asia Pacific.eu : Europe.na : North America. |
appId | String | (Required) Agora App ID. |
roomUuid | String | (Required) The classroom ID. This is the globally unique identifier of a classroom. It is also used as the channel name when a user joins an RTC or RTM channel. The string length must be less than 64 bytes. Supported character scopes are: |
extAppUuid | String | (Required) The extApp ID. The string length must be less than 64 bytes. Supported character scopes are: |
Request body parameters
Pass in the following parameters in the request body.
Parameter | Type | Description |
---|---|---|
properties | Object | The user properties. |
common | Object | The JSON object contains the following fields:state : Integer, the state of extApp. 0 means disabled, and 1 means enabled. |
cause | Object | The update reason. |
Request example
Request Body
Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | Business status code: |
msg | String | The detailed information. |
ts | Number | The current Unix timestamp (in milliseconds) of the server in UTC. |
Response example
Delete the extApp properties
Description
Delete the properties of the extApp in a specified classroom.
Prototype
- Method: DELETE
- Endpoint: /{region}/edu/apps/{appId}/v2/rooms/{roomUUid}/extApps/{extAppUuid}/properties
Request parameters
URL parameters
Pass the following parameters in the URL.
Parameter | Type | Description |
---|---|---|
region | String | (Required) The region for connection. For details, see Network geofencing. Flexible Classroom supports the following regions:cn : Mainland China.ap : Asia Pacific.eu : Europe.na : North America. |
appId | String | (Required) Agora App ID. |
roomUuid | String | (Required) The classroom ID. This is the globally unique identifier of a classroom. It is also used as the channel name when a user joins an RTC or RTM channel. The string length must be less than 64 bytes. Supported character scopes are: |
extAppUuid | String | (Required) The extApp ID. The string length must be less than 64 bytes. Supported character scopes are: |
Request body parameters
Pass in the following parameters in the request body.
Parameter | Type | Description |
---|---|---|
properties | String array | The user properties. |
cause | Object | Reason for deletion. |
Request example
Request Body
Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | Business status code: |
msg | String | The detailed information. |
ts | Number | The current Unix timestamp (in milliseconds) of the server in UTC. |
Response example
Get data for pop-up quizzes
Prototype
- Method: GET
- Request path: /edu/apps/{appId}/v2/rooms/{roomUUid}/widgets/popupQuiz/sequences
Request parameters
URL parameters
Pass the following parameters in the URL:
Parameter | Type | Description |
---|---|---|
appId | String | (Required) Agora App ID. |
roomUuid | String | (Required) The classroom ID. This is the globally unique identifier of a classroom. It is also used as the channel name when a user joins an RTC or RTM channel. The string length must be less than 64 bytes. |
Query parameters
Parameter | Type | Description |
---|---|---|
nextId | String | (Optional) The starting ID of the next batch of data. When you call this method to get the data for the first time, leave this parameter empty or set it as null. Afterward, you can set this parameter as the nextId that you get in the response of the previous method call. |
count | Integer | (Optional) The number of pieces of data in this batch. The default value is 100. |
Response parameters
The fields returned in data
vary in different situations.
-
After the teacher clicks the Start button to start a quiz, the summarized data of the Pop-up Quiz widget updates.
data
contains the following fields:Field name Type Description action Integer The action type changeProperties Object The changed properties changeProperties.extra Object The extra information of the changed properties changeProperties.extra.correctItems Object[] The correct choice changeProperties.extra.correctCount Integer The number of students who have made the correct choice changeProperties.extra.answerState Integer The status of this quiz: 1
: In progress0
: Ended
changeProperties.extra.receiveQuestionTime Long The time when the students receive the question changeProperties.extra.popupQuizId String The question ID changeProperties.extra.averageAccuracy Float The rate at which the correct choice is made for this question changeProperties.extra.totalCount Integer The total number of students who have submitted their answers to this question changeProperties.extra.items Object[] The options of this question changeProperties.state Integer The state of the Pop-up Quiz widget: 0
: Inactive1
: Active
cause String The reason for the property change operator Object The operator of the property change operator.userUuid String The ID of the operator operator.userName String The name of the operator operator.role String The role of the operator -
After a student submits the answer, the student's data updates.
data
contains the following fields:Field name Type Description action Integer The action type changeProperties Object The changed properties changeProperties.lastCommitTime Long The last submit time changeProperties.popupQuizId String The question ID changeProperties.selectedItems Object[] The answer submitted by this student changeProperties.isCorrect Boolean Whether the answer submitted by the student is correct cause String The reason for the property change operator Object The operator of the property change operator.userUuid String The ID of the operator operator.userName String The name of the operator operator.role String The role of the operator fromUser Object The user who starts this quiz fromUser.userUuid String The ID of the user who starts this quiz fromUser.userName String The name of the user who starts this quiz fromUser.role String The role of the user who starts this quiz -
After a student submits the answer, the summarized data of the Pop-up Quiz widget updates.
data
contains the following fields:Field name Type Description action Integer The action type changeProperties Object The changed properties changeProperties.extra Object The extra information of the changed properties changeProperties.extra.selectedCount Integer The number of students who have submitted their answers changeProperties.extra.correctCount Integer The number of students who have made the correct choice changeProperties.extra.averageAccuracy Float The rate at which the correct choice is made for this question changeProperties.extra.totalCount Integer The total number of students who have submitted their answers to this question cause String The reason for the property change operator Object The operator of the property change operator.userUuid String The ID of the operator operator.userName String The name of the operator operator.role String The role of the operator -
After the teacher ends the quiz, the summarized data of the Pop-up Quiz widget updates.
data
contains the following fields:Field name Type Description action Integer The action type changeProperties Object The changed properties changeProperties.extra Object The extra information of the changed properties changeProperties.extra.selectedCount Integer The number of students who have submitted their answers changeProperties.extra.correctCount Integer The number of students who have made the correct choice changeProperties.extra.answerState Integer The status of this quiz: 1
: In progress0
: Ended
changeProperties.extra.averageAccuracy Float The rate at which the correct choice is made for this question changeProperties.extra.totalCount Integer The total number of students who have submitted their answers to this question cause String The reason for the property change operator Object The operator of the property change operator.userUuid String The ID of the operator operator.userName String The name of the operator operator.role String The role of the operator
Response example
-
After the teacher clicks the Start button to start a quiz, the summarized data of the Pop-up Quiz widget updates:
-
After a student submits the answer, the student's data updates:
-
After the teacher ends the quiz, the summarized data of the Pop-up Quiz widget updates:
Get data for polls
Prototype
- Method: GET
- Request path: /edu/apps/{appId}/v2/rooms/{roomUUid}/widgets/poll/sequences
Request parameters
URL parameters
Pass the following parameters in the URL:
Parameter | Type | Description |
---|---|---|
appId | String | (Required) Agora App ID. |
roomUuid | String | (Required) The classroom ID. This is the globally unique identifier of a classroom. It is also used as the channel name when a user joins an RTC or RTM channel. The string length must be less than 64 bytes. |
Query parameters
Parameter | Type | Description |
---|---|---|
nextId | String | (Optional) The starting ID of the next batch of data. When you call this method to get the data for the first time, leave this parameter empty or set it as null. Afterward, you can set this parameter as the nextId that you get in the response of the previous method call. |
count | Integer | (Optional) The number of pieces of data in this batch. The default value is 100. |
Response parameters
The fields returned in data
vary in different situations.
-
After the teacher clicks the Start button to start a poll, the summarized data of the Polling widget updates.
data
contains the following fields:Field name Type Description action Integer The action type changeProperties Object The changed properties changeProperties.extra Object The extra information of the changed properties changeProperties.extra.mode Integer The polling mode: 1
: Single-choice2
: Multiple-choice
changeProperties.extra.pollingState Integer The status of this poll: 1
: In progress0
: Ended
changeProperties.extra.pollDetails Map<String, Object> The polling results. key
is the option index, starting from0
.changeProperties.extra.pollDetails.num Integer The number of students who have selected this option changeProperties.extra.pollDetails.percentage Float The percentage of students who have selected this option in students who have submitted their choices changeProperties.extra.pollId String The poll ID changeProperties.extra.pollItems Object The option content changeProperties.state Integer The state of the Polling widget: 0
: Inactive1
: Active
cause String The reason for the property change operator Object The operator of the property change operator.userUuid String The ID of the operator operator.userName String The name of the operator operator.role String The role of the operator -
After a student submits the choice, the student's data updates.
data
contains the following fields:Field name Type Description action Integer The action type changeProperties Object The changed properties changeProperties.extra Object The extra information of the changed properties changeProperties.extra.pollId String The poll ID changeProperties.extra.selectIndex Object[] The index of the option selected by this student cause String The reason for the property change operator Object The operator of the property change operator.userUuid String The ID of the operator operator.userName String The name of the operator operator.role String The role of the operator fromUser Object The user who starts this poll fromUser.userUuid String The ID of the user who starts this poll fromUser.userName String The name of the user who starts this poll fromUser.role String The role of the user who starts this poll -
After a student submits the answer, the summarized data of the Polling widget updates.
data
contains the following fields:Field name Type Description action Integer The action type changeProperties Object The changed properties changeProperties.extra Object The extra information of the changed properties changeProperties.extra.pollDetails Map<String, Object> The polling results. key
is the option index, starting from0
.changeProperties.extra.pollDetails.num Integer The number of students who have selected this option changeProperties.extra.pollDetails.percentage Float The percentage of students who have selected this option in students who have submitted their choices changeProperties.extra.pollId String The poll ID cause String The reason for the property change operator Object The operator of the property change operator.userUuid String The ID of the operator operator.userName String The name of the operator operator.role String The role of the operator -
After the teacher ends the poll, the summarized data of the Polling widget updates.
data
contains the following fields:Field name Type Description action Integer The action type changeProperties Object The changed properties changeProperties.extra Object The extra information of the changed properties changeProperties.extra.pollingState Integer The status of this poll: 1
: In progress0
: Ended
changeProperties.extra.pollDetails Map<String, Object> The polling results. key
is the option index, starting from0
.changeProperties.extra.pollDetails.num Integer The number of students who have selected this option changeProperties.extra.pollDetails.percentage Float The percentage of students who have selected this option in students who have submitted their choices changeProperties.extra.pollId String The poll ID cause String The reason for the property change operator Object The operator of the property change operator.userUuid String The ID of the operator operator.userName String The name of the operator operator.role String The role of the operator
Response example
-
After the teacher clicks the Start button to start a poll, the summarized data of the Polling widget updates:
-
After a student submits the choice, the student's data updates:
-
After a student submits the choice, the summarized data of the Polling widget updates:
-
After the teacher ends the poll, the summarized data of the Polling widget updates:
Status code
Response status code | Business status code | Description |
---|---|---|
200 | 0 | The request succeeds. |
400 | 400 | The request parameter is incorrect. |
401 | N/A | Possible reasons:x-agora-uid or x-agora-token . |
403 | 30403200 | The classroom is muted globally. Users cannot send chat messages. |
404 | N/A | The server cannot find the requested resource. |
404 | 20404100 | The classroom does not exist. |
404 | 20404200 | The user does not exist. |
409 | 30409410 | The recording has not been started. |
409 | 30409411 | The recording has not been ended. |
409 | 30409100 | The class has been started. |
409 | 30409101 | The class has been ended. |
500 | 500 | The server has an internal error and cannot process the request. |
503 | N/A | Internal server error. The gateway or proxy server does not receive a timely response from the upstream server. |
Events
This section lists all types of events that you can get through the Get classroom events method.
The classroom state changes
When the cmd
property of an event is 1
, the event indicates the classroom state changes, and the data
property contains the following fields:
Parameter | Type | Description |
---|---|---|
startTime | Number | The Unix timestamp (in milliseconds) when the classroom starts, in UTC. This property is available after the state of the classroom changes to "Started". |
state | Integer | The current state of the classroom:
|
Example
Receives a room chat message
When the cmd
property of an event is 3
, the event indicates the server receives a room chat message, and the data
contains the following fields:
Parameter | Type | Description |
---|---|---|
fromUser | Object | The user who sends this message. This object contains the following fields:
|
message | String | The message. |
type | Integer | The type of the message. Temporarily, you can only set this parameter as 1 (text messages). |
Example
Users enter or leave the classroom
When the cmd
property of an event is 20
, the event indicates that users have entered or left the classroom. data
includes the following fields:
Parameter | Type | Description |
---|---|---|
total | Integer | The total number of users who have entered and left the classroom. |
onlineUsers | Object Array | The users who have entered the classroom. This object contains the following fields:
|
offlineUsers | Object Array | The users who have left the classroom. This object contains the following fields:
|
Example
The recording state changes
When the cmd
property of an event is 1001
, the event indicates the recording state changes, and the data
property contains the following fields:
Parameter | Type | Description |
---|---|---|
recordId | String | This is the unique identifier of a recording session. A recording session starts when you call a method to start recording and ends when you call this method to stop recording. This field is available only when state is 1 . |
sid | String | The sid of the Agora Cloud Recording service. This field is available only when state is 1 . |
resourceId | String | The resourceId of the Agora Cloud Recording service. This field is available only when state is 1 . |
state | Integer | The current recording state:
|
startTime | Number | The Unix timestamp (in milliseconds) when the recording starts, in UTC. This property is available after the recording state changes to "Started". |
Example
The number of rewards changes
When the cmd
property of an event is 1101
, the event indicates the number of rewards changes, and the data
property contains the following fields:
Parameter | Type | Description |
---|---|---|
rewardDetails | Object Array | Each object represents the rewards of a user and contains the following fields:userUuid : String. The user ID.changedReward : Integer. The number of changed rewards.total : Integer. The total number of rewards after the change. |
updateTime | Number | The Unix timestamp (in milliseconds) when the rewards change, in UTC. |
Example
The resources in the classroom change
When the cmd
property of an event is 1003
, the event indicates the resources in the classroom change, and the data
property contains the following fields:
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
resources | Object Array | Each object represents a public resource and contains the following fields:resourceUuid : String. The resource ID.resourceName : String. The resource name.size : Number. The resourc size (bytes).url : String. The URL address of the resource.taskUuid : String. The ID of the file conversion task.taskToken : String. The token used for the file conversion task.taskProgress : Object. The progress of a file conversion task. |
operator | Object | It contains the following fields:userUuid : String. The user ID.userName : String. The user name.role : Integer. Th user role. |
action | Integer | The resource change type:1 : The resource is added or updated.2 : The resource is deleted. |
Example
The users "on the stage" change
When the cmd
property of an event is 1501
, the event indicates the users "on the stage" change, and the data
property contains the following fields:
Parameter | Type | Description |
---|---|---|
acceptedUsers | Object Array | The list of users who are now "on the stage". The object contains the following fields:userUuid : String. The user ID. |
addAcceptedUsers | Object Array | The list of users who have just "gone onto the stage". The object contains the following fields:userUuid : String. The user ID. |
removeAcceptedUsers | Object Array | The list of users who have just "left the stage". The object contains the following fields:userUuid : String. The user ID. |
Example
The users who wave their hands change
When the cmd
property of an event is 1502
, the event indicates the users who wave their hands change, and the data
property contains the following fields:
Parameter | Type | Description |
---|---|---|
progressUsers | Object Array | The list of users who are waving their hands. The object contains the following fields:userUuid : String. The user ID.payload : Object. |
addProgressUsers | Object Array | The list of users who have just started waving their hands. The object contains the following fields:userUuid : String. The user ID.payload : Object. |
removeProgressUsers | Object Array | The list of users who have just stopped waving their hands. The object contains the following fields:userUuid : String. The user ID.payload : Object. |
Example