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

    Cast or cancel a vote

    Copy link

    This action adds or removes a vote from a poll option, changing the number of votes given to each option. Use this action to override a previous vote and update the user's final choice of poll options.


    HTTP request

    Copy link
    PUT https://api-{application_id}.sendbird.com/v3/polls/{poll_id}/vote
    

    Parameters

    Copy link

    The following table lists the parameters that this action supports.

    Required
    Parameter nameTypeDescription

    poll_id

    integer

    Specifies the unique ID of the poll.


    Request body

    Copy link

    The following table lists the properties that this action supports.

    Required
    Property nameTypeDescription

    user_id

    string

    Specifies the unique ID of a user who casts or cancels a vote.

    option_ids

    array of integers

    Specifies the array of option IDs to cast or cancel votes. For example, if a user had voted for both Option 1 and Option 2 in a poll, you can specify this property's value as [1,2]. If the user wants to cancel the vote for Option 2 but keep the vote for Option 1, the value should be specified as [1]. If the user wants to cancel the votes for both poll options, the value should be specified as [].


    Response

    Copy link

    If successful, this action returns an updated poll resource in the response body.

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