Example Rest Requests - Amazon Product Advertising API Developer's Manual

Api version 2011-08-01
Table of Contents

Advertisement

Product Advertising API Developer Guide
DateFormat dfm = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
dfm.setTimeZone(TimeZone.getTimeZone("GMT"));
timestamp = dfm.format(cal.getTime());
return timestamp;
}
private String canonicalize(SortedMap<String, String> sortedParamMap)
{
if (sortedParamMap.isEmpty()) {
return "";
}
StringBuffer buffer = new StringBuffer();
Iterator<Map.Entry<String, String>> iter =
sortedParamMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, String> kvpair = iter.next();
buffer.append(percentEncodeRfc3986(kvpair.getKey()));
buffer.append("=");
buffer.append(percentEncodeRfc3986(kvpair.getValue()));
if (iter.hasNext()) {
buffer.append("&");
}
}
String cannoical = buffer.toString();
return cannoical;
}
private String percentEncodeRfc3986(String s) {
String out;
try {
out = URLEncoder.encode(s, UTF8_CHARSET)
.replace("+", "%20")
.replace("*", "%2A")
.replace("%7E", "~");
} catch (UnsupportedEncodingException e) {
out = s;
}
return out;
}
}

Example REST Requests

This section shows the steps to sign a request, using sample AWS access identifiers.
If you follow these steps using these identifiers, you will generate the same signature strings in the
examples. Although this can help verify your request generation code, you cannot make actual requests
with these example requests.
Tip
If you aren't familiar with REST requests, read
continuing with this example.
Request Authentication
Anatomy of a REST Request (p. 46)
API Version 2011-08-01
61
before

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Product Advertising API and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents