GraphQL API: Playback
Get current source for a device
Returns the current playback source for the specified device.
- Get the short-lived audio URL of the current track.
- Retrieve metadata like artist, genre, album, of the current track.
- Get the progress frequency.
- Get the interactions available on the track.
- Get the feedback set on the track.
The source will be available for a limited time. An error will be returned when no source has been set on the device before.
The source can be of different types which will require different logic.
Query
{
playback {
current (deviceUuid: "deviceXYZ") {
... on TrackItem {
audioUrl
interactions
index
trackToken
track {
duration
art {
url (size: WIDTH_130)
}
artist {
name
}
}
}
}
}
}
* 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":"{ playback { current(deviceUuid: \"deviceXYZ\") { ... on TrackItem { audioUrl interactions index trackToken track { duration art { url(size: WIDTH_130) } artist { name } } } } }}"}'
Response
{
"data": {
"playback": {
"current": {
"audioUrl": "https://t3-4.p-cdn.us/access/4801370763899556419?version=5&lid=1375438868&token=LUZc3vC8xvkGaQdrq/0xBMGDAjY/a8dmJfou5L987iBzw9lAhC0Z8kAY5HX3f+VVFQSfhbOMYR4UT2/7AzCO5unIJ7FB+w+98no8Q/TTOE5CG2+ku0X5ERhkHEHW1D3YB6vclvUw8FKSBKKo99+5u80EANpHFSGymakJ+PY8g0pDYeLerxaKh/lBrIlL94xlcJ0Y+MGzFzXyMvNTggRxr476Z1hpgZ6laGjhUHt1zfOI6B09dvba4f4jR1wGU9Ll+L22aBIPnmMifMsxzqZuqaKiHTVn/n2pJLy5RW08Gs+IT3zbJfcGiUFeSq4FXzukpuov1FOUQkj3BViQ3B8I+w==",
"interactions": [
"SKIP",
"REPLAY",
"THUMB"
],
"index": 1,
"trackToken": "P8q7bU-LSkOkouJlpPz4KYHlxV0EZ2D7J4_lo0MAQJXK-rq7vhAbsIZMs7AJAVLagIB9JlMb2sEBFNQuSrSvuODO4yO6Rm66e",
"track": {
"duration": 157,
"art": {
"url": "https://dyn-images.p-cdn.com/?l=images%2Fpublic%2Fint%2F4%2F2%2F5%2F9%2F081227889524%3Acover()&w=150&h=150"
},
"artist": {
"name": "The Cure"
}
}
}
}
}
}