getSessionId

We recommend that you no longer use getSessionId.

If your integration uses getSessionId, it will continue to work. For new integrations, we recommend that you upgrade to getAppLink. See Add authentication for details.

Sonos makes this request on your secure (HTTPS) endpoint.

Request parameters

NameTypeDescription
usernamestringThe username for the account holder
passwordstringThe password for the account holder

Response

NameTypeDescription
getSessionIdResultstring(255)A unique id for the account holder

Details

  • The SOAP header can contain one of two distinct formats in order to authenticate a user. The simplest form is to supply username/password credentials in the header for requests that require user authentication.
  • You can minimize server overhead by using a sessionId as an opaque token that identifies a user. Then use getSessionId to obtain this token. The SOAP header will then contain this sessionId for subsequent message calls instead of a username and password. Because this message does contain sensitive information it is encrypted using SSL.
  • If you are upgrading your implementation from session-based authentication to getAppLink, you must change your implementation of getSessionId to return a Client.AuthTokenExpired SOAP Fault in order to facilitate the upgrade. See Upgrade to OAuth for details.

Sample request

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Body>
  <getSessionId xmlns="http://www.sonos.com/Services/1.1">
    <username>Anderson</username>
    <password>Neo</password>
  </getSessionId>
 </soap:Body>
</soap:Envelope>

Sample response

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <getSessionIdResponse xmlns="http://www.sonos.com/Services/1.1">
      <getSessionIdResult>user0001</getSessionIdResult>
    </getSessionIdResponse>
  </soap:Body>
</soap:Envelope>