GraphQL API: Listener
Get a listener’s allowed search and collection types
Certain features, like on-demand playback, become availble for premium listener accounts. For this reason, it is important to know which features are available to the active listener account in order to customise the application.
The listenerTemplate
query will return the collection and search types that the active listener can interact with. For instance, a free subscription account will only be able to search for station (ST), station factory (SF), podcast (PC), and podcast episode (PE) types since they can only start playback on these types. Starting playback on a track (TR) will result in an error.
An example of running the query with a free subscription listener authenticated:
Query
{
listenerTemplate(template: DEFAULT) {
collectionTypes
searchTypes
}
}
* Add your OAuth bearer token to the Authorization
header
curl 'https://ce.pandora.com/api/v1/graphql/graphql' \
-H 'Authorization: Bearer ' \
-H 'Content-Type: application/json' \
-d '{"operationName":null,"variables":{},"query":"{ listenerTemplate(template: DEFAULT) { collectionTypes searchTypes }}"}'
Response
{
"data": {
"listenerTemplate": {
"collectionTypes": [
"PC",
"PE",
"ST"
],
"searchTypes": [
"PC",
"PE",
"SF",
"ST"
]
}
}
}
When a premium subscription account runs the same query, a different result is returned. In this case, playback can start on Albums (AL), Tracks (TR) and more types.
{
"data": {
"listenerTemplate": {
"collectionTypes": [
"AL",
"AR",
"PL",
"PC",
"PE",
"ST",
"TR"
],
"searchTypes": [
"AL",
"PC",
"PE",
"PL",
"SF",
"ST",
"TR"
]
}
}
}