Retrieve and Delete Discount
Learn to retrieve and delete a discount created for a ticket of an event.
List discounts by organization
For example, we can view the discount on a specific event. For example, we want to view the discount on a specific event.
The following URL uses the GET
method to retrieve the list of discounts:
https://www.eventbriteapi.com/v3/organizations/{organization_id}/discounts?scope={scope_value}
Filter the list of discounts
We can append different parameters with the above URL to retrieve the list of discounts. The table below shows the different values that we can use to filter the list of discounts. It returns a paginated JSON object.
Object | Type | Category | Description |
| string | required | This is the ID of the organization to list the discounts for. |
| string | required | This provides the scope of the discounts that we have to retrieve. The possible values are |
| string | optional | It helps retrieves discounts by an approximate match of text. |
| string | optional | It helps retrieve discounts with an exact match of the |
| number | optional | This object provides the number of discount objects to return per page. |
| string | optional | This object provides the type of discount. The possible values are |
| string | optional | This object helps retrieve the ticket with the exact match provided |
| string | optional | This object helps retrieve the discount with an exact match of |
| string | optional | This object helps retrieve the discounts in the order manner. The possible orders are |
Note: The
event_id
is necessary when using thescope=event
in the filter parameters. We can removeevent_id
from the filter criteria if we are not usingscope=event
.
Let’s see an example to retrieve the discounts list of an event:
import requestsimport jsonurl = 'https://www.eventbriteapi.com/v3/organizations/{{ORGANIZATION_ID}}/discounts?scope=event&event_id={{EVENT_ID}}'headers = {'Authorization': 'Bearer {{PRIVATE_TOKEN}}','Content-Type': 'application/json'}response = requests.request("GET", url, headers=headers).json()print(json.dumps(response, indent=4))
Retrieve a specific discount
If we want to retrieve only one specific discount detail, then we can use the following URL, which uses the GET
method:
https://www.eventbriteapi.com/v3/discounts/{discount_id}/
Only one input parameter, {discount_id}
is required with the URL. It returns the JSON object with all details of the discount.
import requestsimport jsonurl = 'https://www.eventbriteapi.com/v3/discounts/{{DISCOUNT_ID}}/'headers = {'Authorization': 'Bearer {{PRIVATE_TOKEN}}','Content-Type': 'application/json'}response = requests.request("GET", url, headers=headers).json()print(json.dumps(response, indent=4))
Delete a specific discount
If we want to delete a discount on a ticket, then we can use the following URL, which uses the DELETE
method:
https://www.eventbriteapi.com/v3/discounts/{discount_id}/
Only one input parameter, {discount_id}
is required with the URL. If all goes well, it will return the JSON object with two attributes:
{'deleted': True, 'discount_id': '{discount_id}'}
import requestsimport jsonurl = 'https://www.eventbriteapi.com/v3/discounts/{{DISCOUNT_ID}}/'headers = {'Authorization': 'Bearer {{PRIVATE_TOKEN}}','Content-Type': 'application/json'}response = requests.request("DELETE", url, headers=headers).json()print(json.dumps(response, indent=4))