addToContainer

Sonos uses addToContainer to add content to a playlist. See Add playlists for details.

Request

The maximum string length is listed in parentheses. This will be URL-encoded in firmware, so pay attention to length when approaching this limit.

NameTypeDescription
idstring(255)Unique ID of the item to add.
parentIdstring(255)Unique ID of the playlist.
indexintPosition in the playlist where the new content should appear. If you receive an index set to 0, add the content to the beginning of the playlist. If you receive an index set to -1, add the content to the end of the playlist.
updateIdstring(255)Future implementation. Can be used to handle editing collisions.

Sample request message

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <addToContainer xmlns="http://www.sonos.com/Services/1.1">
      <id>track-001</id>
      <parentId>playlist-001</parentId>
      <index>0</index>
      <updateId />
    </addToContainer>
  </soap:Body>
</soap:Envelope>


Response

Include the response in an addToContainerResult inside an addToContainerResponse element.

NameTypeDescription
uniqueIdstring(255)Future implementation. Can be used to handle editing collisions and data concurrency validation.

Sample response

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <addToContainerResponse xmlns="http://www.sonos.com/Services/1.1">
      <addToContainerResult>
         <updateId />
      </addToContainerResult>
    </addToContainerResponse>
  </soap:Body>
</soap:Envelope>