I am trying to add favorites by following this instruction, but I cannot get the title to be read from the strings file. What am I doing wrong?
This is my getExtendedMetadata
response:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.sonos.com/Services/1.1">
<SOAP-ENV:Body>
<ns1:getExtendedMetadataResponse>
<ns1:getExtendedMetadataResult>
<ns1:mediaMetadata>
<ns1:id>album_track:17079|193549</ns1:id>
<ns1:itemType>track</ns1:itemType>
<ns1:title>Sabo & Zeb - Sambafrica</ns1:title>
<ns1:mimeType>audio/mp3</ns1:mimeType>
<ns1:trackMetadata>
<ns1:artistId>artist:1</ns1:artistId>
<ns1:artist>Various Artists</ns1:artist>
<ns1:albumArtistId>artist:1</ns1:albumArtistId>
<ns1:albumArtist>Various Artists</ns1:albumArtist>
<ns1:albumId>album:17079</ns1:albumId>
<ns1:album>10 Years of SOL</ns1:album>
<ns1:duration>451</ns1:duration>
<ns1:albumArtURI>https://assets.s3.amazonaws.com/cover/30929/10.png</ns1:albumArtURI>
</ns1:trackMetadata>
</ns1:mediaMetadata>
<ns1:relatedActions>
<ns1:action>
<ns1:id>add_track_to_my_library</ns1:id>
<ns1:title>ADD_ITEM</ns1:title>
<ns1:actionType>simpleHttpRequest</ns1:actionType>
<ns1:simpleHttpRequestAction>
<ns1:url>https://sonosdev.newmediasquad.com/v1/favorites/add/track/17079</ns1:url>
<ns1:method>POST</ns1:method>
</ns1:simpleHttpRequestAction>
</ns1:action>
</ns1:relatedActions>
</ns1:getExtendedMetadataResult>
</ns1:getExtendedMetadataResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
And this is my strings file:
<?xml version="1.0" encoding="utf-8" ?>
<stringtables xmlns="http://sonos.com/sonosapi">
<stringtable rev="20040502" xml:lang="en-US">
<string stringId="ServicePromo">Welcome to YogiTunes!</string>
<string stringId="LOGIN">Login</string>
<string stringId="SIGNUP">Sign up</string>
<string stringId="ADD_ITEM">Add to My Library</string>
<string stringId="REMOVE_ITEM">Remove from My Library</string>
<string stringId="ADD_SUCCESS">Added successfully</string>
<string stringId="ADD_FAILED">Something went wrong. Please try again or contact us at support@yogi-tunes.com.</string>
<string stringId="REMOVE_SUCCESS">Removed successfully</string>
<string stringId="REMOVE_FAILED">Something went wrong. Please try again or contact us at support@yogi-tunes.com.</string>
<string stringId="Error5Message">Retry token request.</string>
<string stringId="Error100Message">Namaste!! Have some obstacles that need removing? Gan Gan Ganapataye! Contact us at support@yogi-tunes.com and we will get back to you as soon as possible.</string>
</stringtable>
[snip other languages]
</stringtables>
(full string file here)
But, this is what I see in the app:
Other strings are loaded correctly from the strings file. What am I doing wrong?
There's a bug in how the Sonos app displays string text for the <title>
entry in an <action>
under <relatedActions>
. This works for <relatedBrowse>
and <relatedText>
, which is why you're seeing it behave as expected for those actions. We have this in our backlog. I'll update this answer once it has been fixed.
Additionally, we recommend you use a PUT
request for favoriting. Your example shows a POST
request.
Update June 15, 2020 5:00 PM: This has been fixed in the 11.1 release. This will also be reflected in the Sonos developer portal blog later this week.