Participants
Last updated
Last updated
To list all the participants in live rooms, you need to execute a GET request against the /rooms/live/participants endpoint. The result list is grouped by room. The current session_duration of each live room is specified in seconds.
Since potentially there could be thousands of rooms, pagination is supported with limit, order and after arguments. Read about to learn the details of it. By default maximum 100 live rooms will be returned in the response.
If you want to retrieve the participants of one concrete live room execute a GET request against the /rooms/:id/live/participants endpoint
curl --request GET \
--url https://api.digitalsamba.com/api/v1/rooms/live/participants \
--user YOUR_TEAM_ID:YOUR_DEVELOPER_KEY
import com.fasterxml.jackson.databind.ObjectMapper;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.util.Base64;
import java.util.Map;
String TEAM_ID = "YOUR_TEAM_ID";
String DEVELOPER_KEY = "YOUR_DEVELOPER_KEY";
String authorizationHeader = "Bearer " + Base64.getEncoder().encodeToString((TEAM_ID + ":" + DEVELOPER_KEY).getBytes());
HttpRequest request = HttpRequest.newBuilder()
.GET()
.uri(new URI("https://api.digitalsamba.com/api/v1/rooms/live/participants"))
.header("Authorization", authorizationHeader)
.build();
HttpClient client = HttpClient.newHttpClient();
HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
System.out.println("Status code: " + response.statusCode());
System.out.println("Body: " + response.body());
{
"total_count": 5134,
"data": [
{
"id": "bdaa431a-681a-424b-bbcd-30dedb48e6ba",
"external_id": null,
"start_time": "2023-02-13T16:45:05.000000Z",
"session_duration": 2366,
"live_participants": [
{
"id": "eb70c648-e01f-498b-96c8-c3aa2899b2f9",
"external_id": null,
"name": "John Smith",
"role": "moderator",
"join_time": "2023-02-13T16:45:05.000000Z"
},
.........................
]
},
{
"id": "16e4c86d-3030-411a-bfac-4e5a7c427e0a",
"external_id": null,
"start_time": "2023-02-13T16:45:41.000000Z",
"session_duration": 2330,
"live_participants": [
{
"id": "48a12f4c-2262-4ea3-b294-2d24682cc507",
"external_id": null,
"name": "Earl Grey",
"role": "moderator",
"join_time": "2023-02-13T16:45:41.000000Z"
}
]
}
]
}
The total_count is the total amount of rooms which are live. It is NOT the amount of rooms in the current page returned in the data array. In the above example you have 5134 rooms live in total, but in the data array there will be maximum 100 rooms (the default limit argument value).
curl --request GET \
--url https://api.digitalsamba.com/api/v1/rooms/bdaa431a-681a-424b-bbcd-30dedb48e6ba/live/participants \
--user YOUR_TEAM_ID:YOUR_DEVELOPER_KEY
import com.fasterxml.jackson.databind.ObjectMapper;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.util.Base64;
import java.util.Map;
String TEAM_ID = "YOUR_TEAM_ID";
String DEVELOPER_KEY = "YOUR_DEVELOPER_KEY";
String authorizationHeader = "Bearer " + Base64.getEncoder().encodeToString((TEAM_ID + ":" + DEVELOPER_KEY).getBytes());
//Put your room id here - this value is just an example
String roomId = "bdaa431a-681a-424b-bbcd-30dedb48e6ba";
HttpRequest request = HttpRequest.newBuilder()
.GET()
.uri(new URI("https://api.digitalsamba.com/api/v1/rooms/" + roomId + "/live/participants"))
.header("Authorization", authorizationHeader)
.build();
HttpClient client = HttpClient.newHttpClient();
HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
System.out.println("Status code: " + response.statusCode());
System.out.println("Body: " + response.body());
{
"id": "bdaa431a-681a-424b-bbcd-30dedb48e6ba",
"external_id": null,
"start_time": "2023-02-13T16:45:05.000000Z",
"session_duration": 2366,
"live_participants": [
{
"id": "eb70c648-e01f-498b-96c8-c3aa2899b2f9",
"external_id": null,
"name": "John Smith",
"role": "moderator",
"join_time": "2023-02-13T16:45:05.000000Z"
},
.........................
]
}