List
To list the existing polls for a room you need to execute a GET request against the /rooms/:roomId/polls endpoint.
Since potentially there could be a lot of polls, pagination is supported with limit, order and after arguments. Read about pagination to learn the details of it. By default maximum 100 polls will be returned in the response.
Request (listing all polls)
curl --request GET \
--url https://api.digitalsamba.com/api/v1/rooms/c39d7c40-7ff7-4faa-b06f-698a639a9523/polls \
--user YOUR_TEAM_ID:YOUR_DEVELOPER_KEYimport 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 or friendly_url (name) here - this value is just an example
String roomId = "c39d7c40-7ff7-4faa-b06f-698a639a9523";
HttpRequest request = HttpRequest.newBuilder()
.GET()
.uri(new URI("https://api.digitalsamba.com/api/v1/rooms/" + roomId + "/polls"))
.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());Response (200 OK)
{
"total_count": 200,
"data": [
{
"id": "c15102d9-ed47-468c-8e5a-86be0c97c296",
"question": "How many languages have you learned?",
"anonymous": true,
"multiple": true,
"status": "created",
"created_at": "2024-06-27T12:33:21Z"
},
{
"id": "e221af19-6458-438d-820e-afc7c6077112",
"question": "How old are you?",
"anonymous": true,
"multiple": false,
"status": "ended",
"created_at": "2024-06-21T14:25:41Z"
}
...............98 more rooms...............
]
} Request (get a concrete poll)
curl --request GET \
--url https://api.digitalsamba.com/api/v1/rooms/c39d7c40-7ff7-4faa-b06f-698a639a9523/polls/c15102d9-ed47-468c-8e5a-86be0c97c296 \
--user YOUR_TEAM_ID:YOUR_DEVELOPER_KEYimport 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 = "c39d7c40-7ff7-4faa-b06f-698a639a9523";
//Put your poll id here - this value is just an example
String pollId = "c15102d9-ed47-468c-8e5a-86be0c97c296";
HttpRequest request = HttpRequest.newBuilder()
.GET()
.uri(new URI("https://dev-api.monza.digitalsamba.com/api/v1/rooms/" + roomId + "/polls/" + pollId))
.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());Response (200 OK)
{
"id": "c15102d9-ed47-468c-8e5a-86be0c97c296",
"question": "How many languages have you learned?",
"anonymous": true,
"multiple": true,
"status": "created",
"options": [
{
"id": "ee0300ba-be73-4e8a-954a-3a0c2218913e",
"text": "One"
},
{
"id": "34914c0c-2bb6-4e58-9d0c-e393c4b61f5f",
"text": "Two"
},
{
"id": "93d07105-704d-4ced-a924-b266260012ce",
"text": "Three"
},
{
"id": "bf4029ac-461d-4488-ae5e-c6ba03be8ee5",
"text": "More than three"
}
],
"created_at": "2024-06-27T12:33:21Z"
}Last updated