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 |
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
orfalse
, only questions with this value for the fieldactive
will be returned.
- Parameters:
organizer – The
slug
field of the organizer to fetchevent – The
slug
field of the event to fetchquestion – 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 fetchevent – The
slug
field of the event to fetchquestion – The
id
field of the question to fetchid – 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 forevent – The
slug
field of the event to create a option forquestion – The
id
field of the question to create a option for
- Status Codes:
201 Created – no error
400 Bad Request – The option could not be created due to invalid submitted data.
401 Unauthorized – Authentication failure
403 Forbidden – The requested organizer/event does not exist or you have no permission to create this resource.
- PATCH /api/v1/organizers/(organizer)/events/(event)/questions/(question)/options/(id)/¶
Update an option. You can also use
PUT
instead ofPATCH
. WithPUT
, you have to provide all fields of the resource, other fields will be reset to default. WithPATCH
, 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 modifyevent – The
slug
field of the event to modifyid – The
id
field of the question to modifyid – 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 modifyevent – The
slug
field of the event to modifyid – The
id
field of the question to modifyid – The
id
field of the option to delete
- Status Codes:
204 No Content – no error
401 Unauthorized – Authentication failure
403 Forbidden – The requested organizer/event does not exist or you have no permission to delete this resource.