开发人员控制台
感谢您的访问。此页面目前仅提供英语版本。我们正在开发中文版本。谢谢您的理解。

Amazon Music Device API

Redirects

Resource requests may respond with a status code of 301 Moved Permanently, 303 See Other, or 307 Temporary Redirect. A client that receives such a response should resubmit the request (in the manner prescribed by the particular status code) to the URI indicated by the Location header.

In addition, if the status code is 301 Moved Permanently, the client should update any stored references to the original URI.

Alternative redirects

Some client applications, especially those that run in Web browsers, may not be able to handle HTTP redirects correctly. In particular, the XML­HTTP­Request API in certain web browsers automatically follows redirects without providing any means for the client application to determine the target URI of the redirect, which is needed in order to resolve relative paths in remote references that appear in the final document. In some Web browsers, authentication headers are not sent when the request is automatically resubmitted after receiving an HTTP redirect.

Client applications can opt to receive redirects in a manner that should bypass their HTTP client’s automatic redirect-following behavior by sending the X-Amz-Workaround request header with a value of redirect. If the response is a redirect, the response will have a status code of either 200 OK or 204 No Content. The original redirect status code will be sent in the X-Amz-Redirect-Status response header, and the redirect URI will be sent in the X-Amz-Redirect-Location response header. The following example shows a client–server interaction using the alternative redirect mechanism. (Irrelevant HTTP headers have been omitted.)

> GET /abc/ HTTP/1.1
> X-Amz-Workaround: redirect 
< HTTP/1.1 204 No Content< X-Amz-Redirect-Status: 301 Moved Permanently
< X-Amz-Redirect-Location: ../xyz/ 
> GET /xyz/ HTTP/1.1> X-Amz-Workaround: redirect 
< HTTP/1.1 200 OK< Content-Type: application/json< Content-Length: 12345
<< { ... }

International Endpoint Redirects

Client applications with Amazon Music customers outside the United States can take advantage of international endpoints. We encourage client applications to make a best effort to determine which endpoint is in closest proximity to the application user. If the wrong endpoint is chosen initially, application users will still be redirected to the appropriate endpoint tied to the customer’s Amazon Marketplace.

The redirect will be 301 Moved Permanently, and the Alternative Redirects mechanism is supported. All subsequent calls to the Amazon Music API should use the new base endpoint, and client should remember this base endpoint unless redirected to a new endpoint. It is acceptable to call the original endpoint and be redirected again at app launch or reboot if necessary