/ Platform API
Platform API
    Chat Platform API v3
    Chat Platform API
    Chat Platform API
    Version 3

    List polls

    Copy link

    This action retrieves a paginated list of both open and closed polls in an application or a specific channel. To retrieve polls in a specific channel, the channel_url must be specified.


    HTTP request

    Copy link
    GET https://api-{application_id}.sendbird.com/v3/polls
    

    Parameters

    Copy link

    The following table lists the parameters that this action supports.

    Optional
    Parameter nameTypeDescription

    channel_url

    string

    Specifies the URL of the channel. If not specified, all open and closed polls in the client app are retrieved. If channel_type is specified, channel_url must be specified as well.

    channel_type

    string

    Specifies the type of the channel. Acceptable values are open_channels and group_channels, but polls are only available in group_channels. If channel_url is specified, channel_type must be specified as well.

    token

    string

    Specifies a page token that indicates the starting index of results to retrieve. You can get this value from the next property of the previous API response. If not specified, the index is set to 0.

    limit

    integer

    Specifies the number of polls to return per page. Acceptable values are 1 to 20, inclusive. (Default: 20)


    Response

    Copy link

    If successful, this action returns a list of poll resources in the response body.

    {
        "polls": [
            {
                "status": "open",
                "allow_user_suggestion": true,
                "title": "Q2 team gathering",
                "allow_multiple_votes": true,
                "created_at": 1657267925,
                "updated_at": 0,
                "created_by": "Kay",
                "id": 2217,
                "voter_count": 5,
                "close_at": -1,
                "options": [
                    {
                        "text": "May 13 (Fri)",
                        "created_at": 1657267925,
                        "updated_at": 0,
                        "created_by": "Kay",
                        "vote_count": 4,
                        "poll_id": 2217,
                        "id": 3591
                    },
                    {
                        "text": "May 19 (Thurs)",
                        "created_at": 1657268521,
                        "updated_at": 0,
                        "created_by": "Kay",
                        "vote_count": 0,
                        "poll_id": 2217,
                        "id": 3592
                    },
                    {
                        "text": "May 20 (Fri)",
                        "created_at": 1657268547,
                        "updated_at": 0,
                        "created_by": "Kay",
                        "vote_count": 1,
                        "poll_id": 2217,
                        "id": 3593
                    }
                ]
            },
            // More polls follow here.
        ],
        "next": "ansYQFFRQ1AIEUBXX1RcE2dRHB86AkAgNn8eABABBBNFX11fUls"
    }
    

    List of response properties

    Copy link
    Property nameTypeDescription

    polls

    array of objects

    An array of polls that match the specified optional parameters.

    next

    string

    The value for the token parameter to retrieve the next page in the result set. If the value of this property is empty, there is no next page.

    In the case of an error, an error object is returned. A detailed list of error codes is available here.