pythonsonos

Control API: Service unavailable (503)


Good morning,

I want to query households (my first query and generally first experience with the Sonos API) and have authenticated successfully. I got an access token and query the Control API like this:


    headers={"Content-Type" : "application/json",
        "Authorization" : "Bearer " + token["access_token"]}
    resp = re.get('http://api.ws.sonos.com/control/api/v1/househoulds', headers=headers)

It returns me a response with error code "503: Service unavailable":


    
    
    Service Unavailable
    
    
        

Service Unavailable - Zero size object

The server is temporarily unable to service your request. Please try again later.

Reference XXXXX

(I cut out the reference because I am not sure, if it contains credentials). I remember that when I intentionally changed my access token to a wrong one yesterday, I would get an error code back that I am not authorized. But now when I change it to a false one I still just get this same page back (503: Service unavailable).

Does anyone have the same problem? Might it be some security mechanism because I authorized many times in a short time or is the control API just currently down? I tried yesterday and today and don't see a blog post stating a downtime.


Solution

  • I see two issues with the code snippet you provided:

    If you fix those two issues and are indeed using a valid access token, your request should work.