The Link property of every piece of content returned by content APIs is the key for third-party integration with Xbox Music applications:
it contains a deep link that opens the piece of content on an Xbox Music client.
These links exist and are used within Xbox Music applications for sharing the pages of artists, albums, and tracks.
(See the table of examples in this topic.) They open native applications, such as the Windows 8.1 Music application,
Windows Phone Marketplace, and the
http://music.xbox.com web client, depending on the user's platform.
If you're part of our affiliate program, refer to the Building an Affiliate Link section to learn how to build an affiliate link.
Deep links generated by the Xbox Music RESTful API will include an extra partnerId parameter for affiliate tracking.
The template of the redirect URL is as follows:
The parameters type and Id are the only mandatory parameters to identify the content to point to.
|type||enum||Type of content being redirected to; see table of enumerations in this topic.|
|id||string||ID of the item. Parameter type depends on the value of the type parameter.|
The action parameter is optional.Action parameter
|Value||Description||Fallback when not supported|
|view||Default. Launches the content details view.||Xbox Music marketing page|
|play||Launches playback of the media content.||"view" experience|
|addtocollection||Opens the "add to collection" screen on the Xbox Music service.||"view" experience|
|buy||Opens the appropriate purchase flow on the Xbox Music service.||"view" experience|
|Entity||URL pattern||Example URL|
App-to-app direct linking
To ensure the best experience and minimize redirection, you can start the Xbox Music application directly without going through a browser window. Just use the Link parameter you got from the API response in an invisibly instantiated WebView in your app. You can still use the action parameter in the Link to trigger a play—as described in Deep Link, for example.
Following are two code samples that demonstrate how:
Windows Store application
// In your xaml code, create a hidden WebView. <WebView x:Name="HiddenWebView" Visibility="Collapsed" /> // Then when you receive the link, just use it in your WebView. // On Windows 8, the user will be prompted with a popup saying that your app wants to open "Music", // and then it will open in full screen. // On Windows 8.1, the user will have a popup as well, and then the Music app will open // with your app snapped on the side. HiddenWebView.Source = new Uri(xboxMusicRedirectLink);
Windows Phone application
// In your xaml code, create a hidden WebBrowser control <phone:WebBrowser x:Name="HiddenWebBrowser" /> // Then when you receive the link, just use it inside this control HiddenWebBrowser.Navigate(new Uri(xboxMusicRedirectLink));