Item add-ons¶
Resource description¶
With add-ons, you can specify products that can be bought as an addition to this specific product. For example, if you host a conference with a base conference ticket and a number of workshops, you could define the workshops as add-ons to the conference ticket. With this configuration, the workshops cannot be bought on their own but only in combination with a conference ticket. You can here specify categories of products that can be used as add-ons to this product. You can also specify the minimum and maximum number of add-ons of the given category that can or need to be chosen. The user can buy every add-on from the category at most once. If an add-on product has multiple variations, only one of them can be bought. The add-ons resource contains the following public fields:
Field |
Type |
Description |
---|---|---|
id |
integer |
Internal ID of the add-on |
addon_category |
integer |
Internal ID of the item category the add-on can be chosen from. |
min_count |
integer |
The minimal number of add-ons that need to be chosen. |
max_count |
integer |
The maximal number of add-ons that can be chosen. |
position |
integer |
An integer, used for sorting |
multi_allowed |
boolean |
Adding the same item multiple times is allowed |
price_included |
boolean |
Adding this add-on to the item is free |
Endpoints¶
- GET /api/v1/organizers/(organizer)/events/(event)/items/(item)/addons/¶
Returns a list of all add-ons for a given item.
Example request:
GET /api/v1/organizers/bigevents/events/sampleconf/items/11/addons/ 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": 3, "addon_category": 1, "min_count": 0, "max_count": 10, "position": 0, "multi_allowed": false, "price_included": true }, { "id": 4, "addon_category": 2, "min_count": 0, "max_count": 10, "position": 1, "multi_allowed": false, "price_included": true } ] }
- Query Parameters:
page (integer) – The page number in case of a multi-page result set, default is 1
- Parameters:
organizer – The
slug
field of the organizer to fetchevent – The
slug
field of the event to fetchitem – The
id
field of the item to fetch
- Status Codes:
200 OK – no error
401 Unauthorized – Authentication failure
403 Forbidden – The requested organizer/event/item does not exist or you have no permission to view this resource.
- GET /api/v1/organizers/(organizer)/events/(event)/items/(item)/addons/(id)/¶
Returns information on one add-on, identified by its ID.
Example request:
GET /api/v1/organizers/bigevents/events/sampleconf/items/1/addons/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": 3, "addon_category": 1, "min_count": 0, "max_count": 10, "position": 1, "multi_allowed": false, "price_included": true }
- Parameters:
organizer – The
slug
field of the organizer to fetchevent – The
slug
field of the event to fetchitem – The
id
field of the item to fetchid – The
id
field of the add-on 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/bigevents/events/sampleconf/items/1/addons/¶
Creates a new add-on
Example request:
POST /api/v1/organizers/(organizer)/events/(event)/items/(item)/addons/ HTTP/1.1 Host: pretix.eu Accept: application/json, text/javascript Content-Type: application/json { "addon_category": 1, "min_count": 0, "max_count": 10, "position": 1, "multi_allowed": false, "price_included": true }
Example response:
HTTP/1.1 201 Created Vary: Accept Content-Type: application/json { "id": 3, "addon_category": 1, "min_count": 0, "max_count": 10, "position": 1, "multi_allowed": false, "price_included": true }
- Parameters:
organizer – The
slug
field of the organizer of the event/item to create a add-on forevent – The
slug
field of the event to create a add-on foritem – The
id
field of the item to create a add-on for
- Status Codes:
201 Created – no error
400 Bad Request – The add-on 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)/items/(item)/addon/(id)/¶
Update an add-on. 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/items/1/addons/3/ HTTP/1.1 Host: pretix.eu Accept: application/json, text/javascript Content-Type: application/json Content-Length: 94 { "min_count": 0, "max_count": 10 }
Example response:
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json { "id": 3, "addon_category": 1, "min_count": 0, "max_count": 10, "position": 1, "multi_allowed": false, "price_included": true }
- Parameters:
organizer – The
slug
field of the organizer to modifyevent – The
slug
field of the event to modifyitem – The
id
field of the item to modifyid – The
id
field of the add-on to modify
- Status Codes:
200 OK – no error
400 Bad Request – The add-on 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)/items/(id)/addons/(id)/¶
Delete an add-on.
Example request:
DELETE /api/v1/organizers/bigevents/events/sampleconf/items/1/addons/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 item to modifyid – The
id
field of the add-on 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.