# Results

To retrieve the detailed results for a concrete poll you need to execute a **GET** request against the **/rooms/:roomId/polls/:id/results** endpoint.&#x20;

A human readable response is returned where the amount of votes for each option and also the name of the people which voted for each option are listed. Note that the names are **never** listed if the poll is anonymous.

{% hint style="info" %}
Use the **session\_id** argument if you want to retrieve poll results for a concrete session.\
<https://api.digitalsamba.com/api/v1/rooms/c39d7c40-7ff7-4faa-b06f-698a639a9523/polls/c15102d9-ed47-468c-8e5a-86be0c97c296/results?**session\\_id**=16e44502-dae5-41f9-b095-e41bf6ac2d1d>
{% endhint %}

#### Request&#x20;

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```bash
curl --request GET \
  --url https://api.digitalsamba.com/api/v1/rooms/c39d7c40-7ff7-4faa-b06f-698a639a9523/polls/c15102d9-ed47-468c-8e5a-86be0c97c296/results \
  --user YOUR_TEAM_ID:YOUR_DEVELOPER_KEY
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}

```java
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 or friendly_url (name) 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://api.digitalsamba.com/api/v1/rooms/" + roomId + "/polls/" + pollId + "/results"))
  .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());
```

{% endtab %}
{% endtabs %}

#### Response (200 OK)

```json
[
    {
        "id": "8d7c96d8-bff8-4042-968f-0311f4766e94",
        "session_id": "27c01509-adfc-4ea1-ae1c-7896d746578a",
        "question": "How many languages have you learned?",
        "status": "ended",
        "started": "2024-06-27T14:32:03Z",
        "ended": "2024-06-27T14:40:14Z",
        "votes": 16,
        "options": [
            {
                "id": "ee0300ba-be73-4e8a-954a-3a0c2218913e",
                "text": "One",
                "voted": 7, 
                "voters": [
                    {
                        "id": "fc529640-9619-41b7-a94a-1b17adfd6a24",
                        "name": "John Smith"
                    }
                    .... 6 more ...
                ]
            },
            {
                "id": "34914c0c-2bb6-4e58-9d0c-e393c4b61f5f",
                "text": "Two",
                "voted": 6,
                "voters": [ ... ]
            },
            {
                "id": "93d07105-704d-4ced-a924-b266260012ce",
                "text": "Three",
                "voted": 2,
                "voters": [ ... ]                
            },
            {
                "id": "bf4029ac-461d-4488-ae5e-c6ba03be8ee5",
                "text": "More than three",
                "voted": 1,
                "voters": [ ... ]                
            }
        ]
    }
]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalsamba.com/reference/rest-api/polls/results.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
