Type in your question below and we'll check to see what answers we can find...
Loading article...
Submitting...
If you couldn't find any answers in the previous step then we need to post your question in the community and wait for someone to respond. You'll be notified when that happens.
Simply add some detail to your question and refine the title if needed, choose the relevant category, then post.
Before we can post your question we need you to quickly make an account (or sign in if you already have one).
Don't worry - it's quick and painless! Just click below, and once you're logged in we'll bring you right back here and post your question. We'll remember what you've already typed in so you won't have to do it again.
Please see below the most popular frequently asked questions.
Loading article...
Loading faqs...
Please see below the current ongoing issues which are under investigation.
Loading issue...
Loading ongoing issues...
I am a recent new developer, but I had my application working great just a couple of weeks ago. Through the API, I had my application doing just about everything I wanted (adjust volume, start a playlist, do previous and next track, pause, resume). I took about 10 days off. Now most things are not working.
It seems that my GET calls to the API work, but not PUTs.
Is anyone else having this problem?
Solved! Go to Solution.
Could you maybe provide the response body that you're receiving alongside the 404? Might help.
Well, the problem turned out to be that my speakers (Amazon Echo Devices) needed to be rebooted. Once I did this, my code started working again. Thank you all who made suggestions !!!
What does your code do? How do you get an Access token, an with which Scopes?
I don't remember which scopes I originally requested, but my application was working fully just 2 weeks ago. Here are some clips from my code:
1. I am able to get the access token successfully
2. I am able to run GETs like get list of devices
3. I am unable to run PUTs like set volume. This worked two weeks ago.
Thank you for any help you can give me.
#*************************************************************************
# Get Spotify access token
#*************************************************************************
lUrl = f"https://accounts.spotify.com/api/token"
headers = {}
data = {}
# Encode as Base64
message = f"{gClientId}:{gClientSecret}"
messageBytes = message.encode('ascii')
base64Bytes = base64.b64encode(messageBytes)
base64Message = base64Bytes.decode('ascii')
headers['Authorization'] = f"Basic {base64Message}"
data['grant_type'] = "refresh_token"
data['refresh_token'] = gAuthorizationRefreshToken
res = requests.post(lUrl, headers=headers, data=data)
gToken = res.json()['access_token']
#*************************************************************************
# Get a list of devices
#*************************************************************************
lUrl = f"https://api.spotify.com/v1/me/player/devices"
headers = {
"Authorization": "Bearer " + gToken
}
res = requests.get(url=lUrl, headers=headers)
lres = json.dumps(res.json(), indent=2)
#*************************************************************************
# Set Volume
#*************************************************************************
print("Entered Volume Routine")
Volurl = f"https://api.spotify.com/v1/me/player/volume?volume_percent=" + str(ActionValue1) + "&device_id=" + gDevice
headers = {
"Authorization": "Bearer " + gToken
}
print(Volurl)
res = requests.put(url=Volurl, headers=headers)
print(res)
You can try to get a new token with the user-read-playback-state and user-modify-playback-state scopes.
Thank you. I will try that.
What is interesting is that I am not getting any kind of a security response. I am getting a 404 error. This made me think the API might have been down.
Could you maybe provide the response body that you're receiving alongside the 404? Might help.
Thank you for asking for the response body. I was only looking at the status code 404. Here is the full response:
{
"error": {
status": 404,
"message": "Device not found"
}
}
But what is odd is that I know I specified the correct device id. I captured the api string:
And that is a valid device on my system. I can see it when I query for my devices and I have double and tripled checked to see that the device id is correct.. Any idea why the API would return invalid device?
Well, the problem turned out to be that my speakers (Amazon Echo Devices) needed to be rebooted. Once I did this, my code started working again. Thank you all who made suggestions !!!
Hey there you, Yeah, you! 😁 Welcome - we're glad you joined the Spotify Community! While you here, let's have a fun game and get…