List, Cancel, and Delete Events
Learn how to list, cancel, and delete an event using Eventbrite API.
We'll cover the following
List events by organization
The events can be listed in different ways, and we will be listing events by organization_id
. The following URL uses the GET
method to retrieve all the events organized by an organization:
https://www.eventbriteapi.com/v3/organizations/{organization_id}/events/
The {organiztion_id}
is the required input to list the events. It returns a paginated response with a list of events belonging to the provided {organization_id}
. Let’s list the events we created previously.
import requestsimport jsonurl = 'https://www.eventbriteapi.com/v3/organizations/{{ORGANIZATION_ID}}/events/'headers = {'Authorization': 'Bearer {{PRIVATE_TOKEN}}'}response = requests.request("GET", url, headers=headers).json()print(json.dumps(response, indent=4))
The events count can be seen under the attribute pagination.object_count
.
Cancel an event
Eventbrite API also provides us with the facility to cancel an event. The event to be canceled should not have any pending or completed orders. The following URL uses the POST
method to cancel an event:
https://www.eventbriteapi.com/v3/events/{event_id}/cancel/
The above API call requires {event_id}
to cancel an event and returns true
or false
as a response.
import requestsimport jsonurl = 'https://www.eventbriteapi.com/v3/events/{{EVENT_ID}}/cancel/'headers = {'Authorization': 'Bearer {{PRIVATE_TOKEN}}','Content-Type': 'application/json'}response = requests.request("POST", url, headers=headers).json()print(json.dumps(response, indent=4))
Delete an event
We can also delete an event via Eventbrite API. The event to be deleted should not have any pending or completed orders. The following URL uses the DELETE
method to delete an event:
https://www.eventbriteapi.com/v3/events/{event_id}/
The above API call requires {event_id}
to delete an event and returns true
or false
as a response.
import requestsimport jsonurl = 'https://www.eventbriteapi.com/v3/events/{{EVENT_ID}}/'headers = {'Authorization': 'Bearer {{PRIVATE_TOKEN}}','Content-Type': 'application/json'}response = requests.request("DELETE", url, headers=headers).json()print(json.dumps(response, indent=4))