Question options

Resource description

Questions of type “choice” or “multiple choice” can have different options attached. The options resource contains the following public fields:

Field

Type

Description

id

integer

Internal ID of the option

position

integer

An integer, used for sorting

identifier

string

An arbitrary string that can be used for matching with other sources.

answer

multi-lingual string

The displayed value of this option

Changed in version 1.12: This resource has been added.

Endpoints

GET /api/v1/organizers/(organizer)/events/(event)/questions/(question)/options/

Returns a list of all options for a given question.

Example request:

GET /api/v1/organizers/bigevents/events/sampleconf/questions/11/options/ HTTP/1.1
Host: pretix.eu
Accept: application/json, text/javascript

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

{
  "count": 2,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 1,
      "identifier": "LVETRWVU",
      "position": 1,
      "answer": {"en": "S"}
    },
    {
      "id": 2,
      "identifier": "DFEMJWMJ",
      "position": 2,
      "answer": {"en": "M"}
    },
    {
      "id": 3,
      "identifier": "W9AH7RDE",
      "position": 3,
      "answer": {"en": "L"}
    }
  ]
}
Query Parameters
  • page (integer) – The page number in case of a multi-page result set, default is 1

  • active (boolean) – If set to true or false, only questions with this value for the field active will be returned.

Parameters
  • organizer – The slug field of the organizer to fetch

  • event – The slug field of the event to fetch

  • question – The id field of the question to fetch

Status Codes
  • 200 OK – no error

  • 401 Unauthorized – Authentication failure

  • 403 Forbidden – The requested organizer/event/question does not exist or you have no permission to view this resource.

GET /api/v1/organizers/(organizer)/events/(event)/questions/(question)/options/(id)/

Returns information on one option, identified by its ID.

Example request:

GET /api/v1/organizers/bigevents/events/sampleconf/questions/1/options/1/ HTTP/1.1
Host: pretix.eu
Accept: application/json, text/javascript

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

{
  "id": 1,
  "identifier": "LVETRWVU",
  "position": 1,
  "answer": {"en": "S"}
}
Parameters
  • organizer – The slug field of the organizer to fetch

  • event – The slug field of the event to fetch

  • question – The id field of the question to fetch

  • id – The id field of the option to fetch

Status Codes
  • 200 OK – no error

  • 401 Unauthorized – Authentication failure

  • 403 Forbidden – The requested organizer/event does not exist or you have no permission to view this resource.

POST /api/v1/organizers/(organizer)/events/(event)/questions/(question)/options/

Creates a new option

Example request:

POST /api/v1/organizers/bigevents/events/sampleconf/questions/1/options/ HTTP/1.1
Host: pretix.eu
Accept: application/json, text/javascript
Content-Type: application/json

{
  "identifier": "LVETRWVU",
  "position": 1,
  "answer": {"en": "S"}
}

Example response:

HTTP/1.1 201 Created
Vary: Accept
Content-Type: application/json

{
  "id": 1,
  "identifier": "LVETRWVU",
  "position": 1,
  "answer": {"en": "S"}
}
Parameters
  • organizer – The slug field of the organizer of the event/question to create a option for

  • event – The slug field of the event to create a option for

  • question – The id field of the question to create a option for

Status Codes
PATCH /api/v1/organizers/(organizer)/events/(event)/questions/(question)/options/(id)/

Update an option. You can also use PUT instead of PATCH. With PUT, you have to provide all fields of the resource, other fields will be reset to default. With PATCH, you only need to provide the fields that you want to change.

You can change all fields of the resource except the id field.

Example request:

PATCH /api/v1/organizers/bigevents/events/sampleconf/questions/1/options/1/ HTTP/1.1
Host: pretix.eu
Accept: application/json, text/javascript
Content-Type: application/json
Content-Length: 94

{
  "position": 3
}

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

{
  "id": 1,
  "identifier": "LVETRWVU",
  "position": 1,
  "answer": {"en": "S"}
}
Parameters
  • organizer – The slug field of the organizer to modify

  • event – The slug field of the event to modify

  • id – The id field of the question to modify

  • id – The id field of the option to modify

Status Codes
  • 200 OK – no error

  • 400 Bad Request – The option could not be modified due to invalid submitted data

  • 401 Unauthorized – Authentication failure

  • 403 Forbidden – The requested organizer/event does not exist or you have no permission to change this resource.

DELETE /api/v1/organizers/(organizer)/events/(event)/questions/(id)/options/(id)/

Delete an option.

Example request:

DELETE /api/v1/organizers/bigevents/events/sampleconf/questions/1/options/1/ HTTP/1.1
Host: pretix.eu
Accept: application/json, text/javascript

Example response:

HTTP/1.1 204 No Content
Vary: Accept
Parameters
  • organizer – The slug field of the organizer to modify

  • event – The slug field of the event to modify

  • id – The id field of the question to modify

  • id – The id field of the option to delete

Status Codes