Include a User-Agent header in all requests

How to include a user-agent header in all requests.

A User-Agent header identifies your application, its version number, and the platform and programming language that you are using. You must include a User-Agent header with every request that you submit to the Selling Partner API. Doing this helps Amazon more effectively diagnose and fix problems, helping to improve your experience using the service.

To create a User-Agent header, begin with the name of your application, followed by a forward slash, followed by the version of the application, followed by a space, an opening parenthesis, the Language name/value pair, and a closing parenthesis. The Language parameter is a required attribute, but you can add additional attributes separated by semicolons.

The following pseudocode illustrates a minimally acceptable User-Agent header:

AppId/AppVersionId (Language=LanguageNameAndOptionallyVersion)

The following is an example of a User-Agent header that might be used by an application developer:

My Selling Tool/2.0 (Language=Java/1.8.0.221; Platform=Windows/10)

If you are a large selling partner who is integrating through your own IT department, consider creating a User-Agent header that contains the Host attribute, as in the following example. This can help an Amazon support engineer troubleshoot problems for you more effectively.

MyCompanyName/build1611 (Language=Perl; Host=jane.desktop.example.com)

To specify additional attributes, use the format AttributeName=Value;, separating each name/value pair with a semicolon. If you need to use a backslash (\), quote it with another backslash (\\). Similarly, quote a forward slash in the application name (\/), an opening parenthesis in the application version (\(), an equal sign in the attribute name (\=), and both a closing parenthesis (\)), and a semicolon (\;) in attribute values.

Because the User-Agent header is transmitted in every request, it is a good practice to limit the size of the header. The Selling Partner API will reject a User-Agent header if it is longer than 500 characters.