How do I update a poll using curl?

Hello. Unfortunately, I can’t write a suitable curl call to change the title or description of a poll, for example. The other functions work perfectly.

https://github.com/nextcloud/polls/blob/master/docs/API_v1.0.md#default-functions

Can someone please post me a working example? Thank you!

You should be able to update the poll via PUT /api/v1.0/poll/{pollId} and the corresponding json payload after authentication.

But there is a bug, the API expects ‘pollConfiguration’ as payload, instead of ‘poll’, as stated in the API documentation. I will update the docs.

Get the poll: GET /api/v1.0/poll/1
Return ist something like this (truncated to the configuration settings):

{
  "poll": {
    "id": 1,
    "type": "textPoll",
    "configuration": {
      "title": "Your favorite Planet",
      "description": "",
      "access": "private",
      "allowComment": true,
      "allowMaybe": true,
      "allowProposals": "disallow",
      "anonymous": false,
      "autoReminder": true,
      "expire": 0,
      "hideBookedUp": true,
      "proposalsExpire": 0,
      "showResults": "always",
      "useNo": true,
      "maxVotesPerOption": 0,
      "maxVotesPerUser": 0
    },
  }
}

To change the title you call PUT /api/v1.0/poll/1 with a payload like:

{
  "pollConfiguration": {
      "title": "Your most hated Planet"
      "description": "State it here",
    }
}