Recieving an "errorCode: ERROR_RESOURCE_GONE" when trying to send play command

258 Views Asked by At

I have been trying to figure out the sonos api over the past few days, but unfortuanetly have hit a road block. I have already gotten my tokens and room names and and favorites Id, but when I send the curl request to play a song I get the error described above.

Curl Code : curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer {TOKEN}" "https://api.ws.sonos.com/control/api/v1/groups/RINCON_48A6B88A5B14014XX:XXXXXXXXXX/favorites" --data @play.json

I keep the body in a .json file called play which contains the code:

{ "favoriteId":2, "playOnCompletion":true }

I have not been able to find any documentation on this issue online, so any and all help is very appreciated.

2

There are 2 best solutions below

0
On

Have you made sure that the groupId or the favoriteId are still valid? Based on the ERROR_RESOURCE_GONE, it seems one of those has likely changed.

0
On

The "ERROR_RESOURCE_GONE" HTTP 410 response indicates that the groupID you are using in your request (RINCON_48A6B88A5B14014XX:XXXXXXXXXX) no longer exists. Group IDs are not static and may change depending on a number of factors - grouping and ungrouping, power cycling, etc.

If you re-run the request to get groups, you should get an up-to-date list of group IDs. Try doing that and using a returned Group ID in your favorites request.

The "Subscribe" section of the documentation describes how to automatically listen for group ID changes: https://developer.sonos.com/build/direct-control/connect/