QueryObject

The Class that represents StubHub Unified Search Query object. Use this class for constructing the URL path and query parameters for a StubHub search API. This is a sample URL path with query parameters (which appear after the StubHub domain name) to search for events that take place in ‘San Francisco OR New York': https://api.stubhub.com/search/catalog/events/v3/?city="San Francisco”|"New York"
(protected) new QueryObject()  

Members

type

Query type
Type
  • String

Methods

contains

contains(key, substring) → {Query}  
Searches for string values that contain the provided string. NOTE: If you are performing this query on a large dataset, the search may take more processing time to return the results.
Parameters
NameTypeDescription
key
String
The key that the string to match is stored in.  
substring
String | Array.<String>  
The substring that the value must contain, or a list of substrings that at least one of the substrings contains the provided string.  
Returns

date

date(d) → {Query}  
Searches for an Event at a specified date. NOTE: This method only applies to a Query object whose type is Event.
Parameters
NameTypeDescription
d
String | Date  
A date string in the format yyyy-MM-dd or a JavaScript Date object.  
Returns

dateRange

dateRange(start, end) → {Query}  
Searches for an Event within the specified date range. NOTE: This method only applies to a Query object whose type is Event.  
Parameters
NameTypeDescription
start
String | Date  
The beginning of the date range. This is specified as a string in the format yyyy-MM-dd or as a JavaScript Date object.  
end
String | Date  
The end of the date range. This is specified as a string in the format yyyy-MM-dd or as a JavaScript Date object.  
Returns

equalTo

equalTo(key, value) → {Query}  
Restricts the query to return only the value of a key that is equal to the provided value.  
Parameters
NameTypeDescription
key
String
The key to search for.  
value
String | Array.<String>  
The value of the key to match, or a list of comma-separated values to find at least one match.  
Returns

hasTicket

hasTicket(b) → {Query}  
Searches for an Event that only has tickets on sale. NOTE: This method only applies to a Query object whose type is Event.
Parameters
NameTypeDescription
b
Boolean
True means search for an event that has tickets on sale. False means ignore the event that has tickets on sale.  
Returns

limit

limit(n) → {Query}  
Sets the limit on number of results to return.  
Parameters
NameTypeDescription
n
Number
The maximum number of results to return.  
Returns

localDate

localDate(d) → {Query}  
Searches for an Event at a specified date without calculating timezones. This method is similar to date. For example, you can use this method to get all events across a country for a given date. NOTE: This method only applies to a Query object whose type is Event.  
Parameters
NameTypeDescription
d
String | Date  
A date string in the format yyyy-MM-dd(THH:mm) or a JavaScript Date object.  
Returns

localDateRange

localDateRange(start, end) → {Query}  
Searches for an Event at a specified date range without calculating timezones. This method is similar to dateRange. For example, you can use this method to get all events across a country for a given date range. NOTE: This method only applies to a Query object whose type is Event.
Parameters
NameTypeDescription
start
String | Date  
The beginning of the date range. Specify this as a string in the format yyyy-MM-dd or as a JavaScript Date object.  
end
String | Date  
The end of the date range. Specify this as a string in the format yyyy-MM-dd or as a JavaScript Date object.  
Returns

locateAt

locateAt(location) → {Query}  
Specify a property of the location object to search for. NOTE: This method only applies to a Query object whose type is Event or Venue.
Parameters
NameTypeDescription
location
Object
Represents the location object, which has the properties as described in the table below. Properties
Name Type Description
city Object (Optional) City
state Object (Optional) State (2-letter code)
country Object (Optional) County (2-letter ISO code)
postalCode Object (Optional) Postal Code o ZIP Code
 
Returns

notContains

notContains(key, substring) → {Query}  
Searches for string values that do not contain a provided string. NOTE: If you are performing this query on a large dataset, the search may take more processing time to return the results.
Parameters
NameTypeDescription
key
String
The key that the string to match is stored in.  
substring
String
The substring that the value must not contain.  
Returns

notEqualTo

notEqualTo(key, value) → {Query}  
Adds a constraint for finding string values that do not match a provided string.  
Parameters
NameTypeDescription
key
String  
The key that the non-matching string is stored in.  
value
String
The value to eliminate from the query results.  
Returns

offset

offset(n) → {Query}  
Sets the number of results to skip before returning any results.  
Parameters
NameTypeDescription
n
String
The number of results to skip.  
Returns

select

select(f) → {Query}  
Restricts the fields that the object(s) returns.  
Parameters
NameTypeDescription
f
String
The names of the fields in comma-separated-value (CSV) format (such as select ('city', 'state', 'country').  
Returns

sort

sort() → {Query}  
Sort the query results. NOTE: Each type of Query has a different set of available sort fields. See the examples below.  
Parameters
Returns
Example
// For an event query, the available sort fields are 'popularity', 'name','eventDateLocal', or 'distance'.
new Query('Event').sort('eventDateLocal');
// For a venue query, the available sort fields are 'name', or 'distance'.
new Query('Venue').sort('distance');
// For a performer query, the available sort field is 'name'.
new Query('Performer').sort('name');
 

withInMiles

withInMiles(point, Maximum) → {Query}  
Specifies the maxmium distance (or radius) from a given GeoPoint that a query searches for events. NOTE: This method only applies to a Query object that has a type of Event or Venue.  
Parameters
NameTypeDescription
point
Refers to the specified GeoPoint.  
Maximum
Number
The distance (in miles) of results to return.  
Returns