GraphQL API: Collection
Get a listener’s collected items
To get a listener’s collected items you can narrow down the results by specifying the types you would like to receive. It is also possible to limit the number of items returned and/or paginate through the results. See pagination for more info.
Request
{
collection (types: [ST], pagination: {limit: 3}) {
items {
id
... on Station {
name
art {
url (size: WIDTH_130)
}
}
}
}
}
* 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":"{ collection(types: [ST], pagination: {limit: 3}) { items { id ... on Station { name art { url (size: WIDTH_130) }}}}}"}'
Response
{
"data": {
"collection": {
"items": [
{
"id": "ST:0:4363314726864390164",
"name": "Out Here (SFR Remix) Radio",
"art": {
"url": "https://dyn-images.p-cdn.com/?l=images%2Fpublic%2Fint%2F2%2F0%2F8%2F3%2F859726373802%3Acover()&w=160&h=160"
}
},
{
"id": "ST:0:4363284700748023828",
"name": "Dance Monkey Radio",
"art": {
"url": "https://dyn-images.p-cdn.com/?l=images%2Fpublic%2Fint%2F2%2F7%2F8%2F8%2F075679838872%3Acover()&w=160&h=160"
}
},
{
"id": "ST:0:4326927884191762452",
"name": "The Oh Hellos Radio",
"art": {
"url": "https://dyn-images.p-cdn.com/?l=images%2F02%2Fd1%2F7c%2F39%2Fa1304e4ca39c3aeae530e4d3%2F%3Acover()&w=160&h=160"
}
}
]
}
}
}
Sorting
You can sort collections by the time they were collected, modified, or their name. Results can also be ordered ascending or descending.
Request
{
collection (types: [ST, AL], pagination: { limit: 3, sortBy: ADDED_TIME, sortOrder: DESC } ) {
items {
id
... on Station {
name
art {
url (size: WIDTH_130)
}
}
... on Album {
name
art {
url (size: WIDTH_130)
}
}
}
}
}
* 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":"{ collection(types: [ST, AL], pagination: {limit: 3, sortBy: ADDED_TIME, sortOrder: DESC}) { items { id ... on Station { name art { url(size: WIDTH_130) }} ... on Album { name art { url(size: WIDTH_130) }}}}}"}'
Response
{
"data": {
"collection": {
"items": [
{
"id": "ST:0:4326927884191762452",
"name": "The Oh Hellos Radio",
"art": {
"url": "https://dyn-images.p-cdn.com/?l=images%2F02%2Fd1%2F7c%2F39%2Fa1304e4ca39c3aeae530e4d3%2F%3Acover()&w=160&h=160"
}
},
{
"id": "ST:0:4326825814293973012",
"name": "Canaan Smith Radio",
"art": {
"url": "https://dyn-images.p-cdn.com/?l=images%2F0c%2F39%2Ff2%2Ff1%2F8f2645ee9f811dea13436a9c%2F%3Acover()&w=160&h=160"
}
},
{
"id": "ST:0:4326825706919790612",
"name": "Radiohead Radio",
"art": {
"url": "https://dyn-images.p-cdn.com/?l=images%2F0e%2Ff2%2F32%2Ffe%2F416844b9a62f9dcf2514a5fc%2F%3Acover()&w=160&h=160"
}
}
]
}
}
}
Limitations: There are some limitations on what can be sorted, e.g., only stations can be sorted by name and descending order. If you attempt to use a sorting combination that is not supported, you will get this error:
{
"errors": [
{
"message": "Exception - INVALID_SORT_ORDER [99023]: The supplied sort order is not supported for this sorted view.: ",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"collection"
],
"extensions": {
"code": "UPSTREAM_ERROR_SERVICE"
}
}
],
"data": {
"collection": null
}
}