0

The Eventbrite documentation on the ticket object indicates that it can contain a quantity_available or quantity_sold field, but that to see either of these fields "requires authentication". It doesn't give any more detail than that, though, and when I make calls to the event_search method using my app key, the tickets objects in the returned events do not contain quantity_available or quantity_sold keys.

What authentication is required to see these fields? Are they only visible to the owners of the event, or is it possible in some way for me to have the API return the number of tickets available for somebody else's event?

If this is not possible through the API, is the number of tickets remaining for an event publicly visible anywhere else on Eventbrite where I could get to it with a web scraper?

Mark Amery
  • 143,130
  • 81
  • 406
  • 459

2 Answers2

1

This needs to be called as an expansion. There are some more details here: https://groups.google.com/forum/#!msg/eventbrite-api/sjMO-gV8-Go/uzw7GHq2_SEJ

Basically, calling it like so will populate the proper fields using your Apps OAuth token in python3:

import requests    
eventbrite_response = requests.get(
    "https://www.eventbriteapi.com/v3/events/<YOUR EVENT ID HERE>/?expand=ticket_classes",
    headers = {
        "Authorization": "Bearer <YOUR APP OAUTH TOKEN>",
    },
    verify = True,  # Verify SSL certificate
    )
print(eventbrite_response.json()['ticket_classes'][0]['quantity_sold'])

You can tailor the print function at the end to include more of the json data if you wish.

Bryan D
  • 11
  • 1
0

In order to read or write private data using the Eventbrite API, you will need to supply additional user-authentication tokens. This extra information lets Eventbrite know who should be authorized to access private data (including quantity_available and quantity_sold values) during the request.

Whenever you provide additional user access tokens, both public and private data will be available.

Authentication parameters include:

app_key: An application key (also referred to as an API key), identifies the application that is contacting the API. All API requests must include some form of application identification. If this is the only authentication token provided, the API request will be limited to publicly available data. Application keys have a default rate-limit of 1000 requests per day. You can get and manage your API keys here: https://www.eventbrite.com/api/key/

access_token: Recommended. OAuth2 access tokens are tied to a user account and an application key. Since the user-authorized application can also be identified via this token, it is the only authentication parameter that does not require an application key to be provided as well. Be careful not to expose these tokens to other users! Additional request headers are required when using access_tokens to contact our API: “Authorization: Bearer YOUR_ACCESS_TOKEN_HERE“. You can learn more about how to configure your application for OAuth2.0 here: http://developer.eventbrite.com/doc/authentication/oauth2/

user_key: Each Eventbrite account has an associated user_key. This token provides access to the related user’s account data, in addition to our publicly available data. This authentication method is preferred for use-cases that require private data-access where OAuth2.0 workflows are not possible. This token unlocks sensitive information, so be very careful not to expose this token to other users!

Here is an example of an API call that is using both the app_key and user_key parameters to return private data (remember to substitute in your own app_key and user_key):

https://www.eventbrite.com/json/user_list_events -G -d app_key=APPKEY -d user_key=USERKEY

You can also see the authentication documentation here: http://developer.eventbrite.com/doc/authentication/

Claire
  • 169
  • 4
  • Just to confirm: `quantity_available` and `quantity_sold` are 'private' in the sense that they are only visible to the user who created the event? Perhaps I wasn't clear in my question; it's not the mechanics of the authentication processes that I'm struggling to understand from the docs, it's understanding what any given level of authentication entitles me to see. Am I really correct in understanding that I'm not permitted to know how many tickets an event has left available unless I'm the event owner (or have an access_token associated with the owner)? – Mark Amery Mar 10 '13 at 17:00
  • Hi @MarkAmery - did you find a solution afterwards? – Chul Kwon Nov 19 '15 at 16:51
  • Nope, never found out what permissions are required to view the `quantity_available` and `quantity_sold` fields of an event. This answer was basically useless; it just explains how to do authentication on API calls (which I already made clear I knew how to do in the question!) and offers zero information about who is actually allowed to access the fields I'm interested in. It looks like the API and have changed massively now, and I haven't touched Eventbrite in years, so I don't know whether this question is even still meaningful or whether the docs now contain the answer. – Mark Amery Nov 19 '15 at 17:42