---
title: "Update poll"
canonical: "https://support.appfire.com/space/POLL/151847060/Update%20poll"
format: markdown
---
> Macro (aura-html)

Updates a poll using the given poll ID. 

- Similar to create API except that it updates the required poll through its ID.
- A poll can be updated even if you provide the mandatory parameters only. The default values for the optional parameters, if any, are then used.
- All mandatory parameters are validated. Depending on the incorrect or missing data, error messages are generated. See [Validations](https://mohamicorp.atlassian.net/wiki/spaces/POLL/pages/2902622215).
- The response returns code 200 if the poll update was successful else error messages are generated. See [Error codes](https://mohamicorp.atlassian.net/wiki/spaces/POLL/pages/2902622215).

> ⚠️ The operation uses basic authentication.

# Resource URL

***PUT**** method on <ConfluenceBaseURL>/rest/polls/1.0/poll/{pollGuid}*

*ConfluenceBaseURL* is the URL of your Confluence instance

Sample URL: **[http://localhost:1990/confluence/rest/polls/1.0/poll/f2945cb488a341198bb7ecf173f5db07](http://localhost:1990/confluence/rest/polls/1.0/poll/f2945cb488a341198bb7ecf173f5db07)**

# Parameters

See [Parameters](https://mohamicorp.atlassian.net/wiki/spaces/POLL/pages/2902949889/API+reference#Common-parameters) to learn more about the required and optional parameters of both choice and event polls.

<details>
<summary>Quick reference (Parameter name - default value, if any; mandatory fields are marked with *)</summary>

*name* <span style="color: #ff5630">*</span>

*description*

*enddate*

*datePoll* - *false* (*true* to create event poll)

*nonUserVotesAllowed* - *false*

*pollAnonymous* - *false*

*votersVisible* - *true*

*resultsBeforeClosed* - *true*

*undoAllowed* - *true*

*multipleChoice* - *false*

*optionsExtendable* - *false*

*tinyUrlEnabled* - *false*

*percentsVisible* - *true* (available for choice poll only)

*voteCountVisible* - *true*

*options* <span style="color: #ff5630">*</span>

*stringValue* (<span style="color: #ff5630">*</span> for choice poll & at least two values are required)

*dateValue* (<span style="color: #ff5630">*</span> for event poll & at least one value is required)

Format to be used for *options*:

| **Choice poll** | **Event poll** |
| --- | --- |
| `"options":`<br>`[`  
`{ "stringValue": "choice1" },`  
`{ "stringValue": "choice2" }`  
`]` | `"options":`<br>`[`<br>`{"dateValue":"2022-06-19", "stringValue": "1"}`<br>`{"dateValue":"2022-05-20", "stringValue": "2"}`<br>`]` |
</details>

# Example request

<details>
<summary>Sample request payload to create a choice poll</summary>

`{`  
`  "``name``": "Choice poll - What product do you like best?",`  
`  "description": "Choose the product you like most",`  
`  "datePoll": false,`  
`  "nonUserVotesAllowed": false,`  
`  "pollAnonymous": false,`  
`  "votersVisible": true,`  
`  "percentsVisible": true,`  
`  "votesCountVisible": true,`  
`  "resultsBeforeClosed": true,`  
`  "undoAllowed": true,`  
`  "multipleChoice": false,`  
`  "optionsExtendable": false,`  
`  "tinyUrlEnabled": false,`  
`  "options": [`  
`    { "stringValue": "choice1" },`  
`    { "stringValue": "choice2" }`  
`  ],`  
`  "closedAt": "2022-03-19"`  
`}`
</details>

<details>
<summary>Sample request payload to create an event poll</summary>

`{`  
`  "name": "Event Poll- Select the meeting time for conference",`  
`  "description": "Choose the time for meeting ?",`  
`  "datePoll": true,`  
`  "multipleChoice": true,`  
`  "pollAnonymous": false,`  
`  "votersVisible": true,`  
`  "nonUserVotesAllowed": false,`  
`  "resultsBeforeClosed": true,`  
`  "undoAllowed": true,`  
`  "tinyUrlEnabled": false,`  
`  "optionsExtendable": false,`  
`  "options": [`  
`    { "dateValue": "date1","stringValue":"1AM" },`  
`    { "dateValue": "date2"}`  
`  ],`  
`  "closedAt": "2022-03-19"`  
`}`
</details>

# Example response

<details>
<summary>Sample response after successful execution of request</summary>

`{`  
`"result": "ok",`  
`"guid": "7cf62f8135c1455888bf13e1dd125e5b",`  
`"status": "200"`  
`}`
</details>

# Validations

| **Validation condition** | **Validated parameter name(s)** | **Message** | **Requirement** |
| --- | --- | --- | --- |
| If poll name is missing in the request payload | *name* | - For choice poll: “Please fill in a question.”
- For event poll: “Please fill in the name of the event.” | Poll name is mandatory to create polls. |
| If options and its attributes are missing in the request payload | - *options*
- *dateValue* (in case of event poll) | - For choice poll: “Please provide at least two choices.”
- For event poll: “Please provide at least one date.” | - For choice polls, at least two choices must be provided.
- For event poll, at lease one date must be given. |
| Data validation | - *name*
- *description*
- *enddate*
- *stringValue* (in case of choice poll) | - Poll name and description should be less than 1024 characters.
- Poll descriptions should be less than 255 characters.
- Choice poll option should be less than 255 characters.
- End date should not be less than current date. |  |

# Error codes

| **Code** | **Cause of error** | **Message displayed** |
| --- | --- | --- |
| 412 | Validation errors as mentioned in the above table. See [Validations](https://mohamicorp.atlassian.net/wiki/spaces/POLL/pages/2902622215). |  |
| 403 | User is not permitted to perform a particular operation. | Operation failed with error not allowed. |
| 401 | Invalid user credentials. | Operation failed with error unauthorized. |