Options

The Options API supports managing poll options.

Get poll option

Gets a poll option.

GET /api/options/{id}
Path parameters
id integer required

Id of the option.

Example request
curl https://{WEAVY-SERVER}/api/options/1
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Response codes

200 Success
401 Unauthorized
404 Not Found

Response schema
{
  "id": "integer",
  "text": "string",
  "vote_count": "integer",
  "has_voted": "boolean",
  "voters": [
    {
      "id": "integer",
      "uid": "string",
      "display_name": "string",
      "email": "string",
      "given_name": "string",
      "middle_name": "string",
      "name": "string",
      "family_name": "string",
      "nickname": "string",
      "phone_number": "string",
      "comment": "string",
      "directory_id": "integer",
      "picture_id": "integer",
      "avatar_url": "string",
      "metadata": "object",
      "tags": [
        "string"
      ],
      "presence": "string",
      "created_at": "string",
      "modified_at": "string",
      "is_bot": "boolean",
      "is_suspended": "boolean",
      "is_trashed": "boolean"
    }
  ]
}

List voters

List users that voted for the specified poll option.

GET /api/options/{id}/voters
Path parameters
id integer required

Option id.

Example request
curl https://{WEAVY-SERVER}/api/options/1/voters
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Response codes

200 Success
401 Unauthorized
404 Not Found

Response schema
[
  {
    "id": "integer",
    "uid": "string",
    "display_name": "string",
    "email": "string",
    "given_name": "string",
    "middle_name": "string",
    "name": "string",
    "family_name": "string",
    "nickname": "string",
    "phone_number": "string",
    "comment": "string",
    "directory_id": "integer",
    "picture_id": "integer",
    "avatar_url": "string",
    "metadata": "object",
    "tags": [
      "string"
    ],
    "presence": "string",
    "created_at": "string",
    "modified_at": "string",
    "is_bot": "boolean",
    "is_suspended": "boolean",
    "is_trashed": "boolean"
  }
]

Vote

Add vote for the authenticated user to a poll option.

POST /api/options/{id}/vote
Path parameters
id integer required

Id of the poll option.

Example request
curl -X POST https://{WEAVY_SERVER}/api/options/1/vote
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Response codes

200 Success
401 Unauthorized
403 Forbidden
404 Not Found

Response schema
{
  "id": "integer",
  "text": "string",
  "vote_count": "integer",
  "has_voted": "boolean",
  "voters": [
    {
      "id": "integer",
      "uid": "string",
      "display_name": "string",
      "email": "string",
      "given_name": "string",
      "middle_name": "string",
      "name": "string",
      "family_name": "string",
      "nickname": "string",
      "phone_number": "string",
      "comment": "string",
      "directory_id": "integer",
      "picture_id": "integer",
      "avatar_url": "string",
      "metadata": "object",
      "tags": [
        "string"
      ],
      "presence": "string",
      "created_at": "string",
      "modified_at": "string",
      "is_bot": "boolean",
      "is_suspended": "boolean",
      "is_trashed": "boolean"
    }
  ]
}