Call Amazon Product Advertising API 5.0 (PA-API v5) in Java

Overview

--Call Amazon Product Advertising API 5.0 (PA-API v5) in Java --Call the API directly without using the official SDK provided by AWS --Implement AWS Signature Version 4 processing only with the Java standard library --This execution environment: macOS Catalina + Java 15 (AdoptOpenJDK 15) + Jackson Databind 2.11.1 + Gradle 6.6.1

Sample code

File list

├── build.gradle
└── src
    └── main
        └── java
            ├── AwsSignature4.java
            ├── JsonUtil.java
            ├── MyApp.java
            └── PaApi5Wrapper.java

build.gradle

Gradle configuration file. The JSON manipulation library is not in the Java standard library, so Jackson is used.

plugins {
  id 'java'
  id 'application'
}

repositories {
  mavenCentral()
}

dependencies {
  //Use Jackson
  implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.1'
}

application {
  mainClassName = 'MyApp'
}

sourceCompatibility = JavaVersion.VERSION_15

src/main/java/MyApp.java

import java.util.HashMap;
import java.util.Map;

/**
 * PA-A sample class that calls API v5.
 */
public class MyApp {

  public static void main(String[] args) throws Exception {
    // PA-Call API v5
    searchItems();
    getItems();
  }

  private static final String ACCESS_KEY = "<YOUR-ACCESS-KEY-HERE>"; //Obtained access key
  private static final String SECRET_KEY = "<YOUR-SECRET-KEY-HERE>"; //Obtained secret key
  private static final String TRACKING_ID = "<YOUR-PARTNER-TAG-HERE>"; //Tracking ID(Example: XXXXX-22)

  //Search for products by keyword
  public static void searchItems() throws Exception {

    String keywords = "Shakespeare";

    //Request information
    Map<String, Object> req = new HashMap<>() {
      {
        put("ItemCount", 3); //Number of search results
        put("PartnerTag", TRACKING_ID); //Store ID or tracking ID
        put("PartnerType", "Associates"); //Partner type
        put("Keywords", keywords); //Search keyword
        put("SearchIndex", "All"); //Search category(All, AmazonVideo, Books, Hobbies,Music etc. can be specified)
        put("Resources", new String[]{ //Type of value to include in the response
          "ItemInfo.Title",
          "ItemInfo.ByLineInfo",
          "ItemInfo.ProductInfo",
          "Images.Primary.Large",
          "Images.Primary.Medium",
          "Images.Primary.Small"
        });
      }
    };

    //Make request information a JSON string
    String reqJson = new JsonUtil().objectToJson(req);
    System.out.println("=====Search for products by keyword:request=====");
    System.out.println(reqJson);

    // PA-Call API v5 and receive the result as a JSON string
    PaApi5Wrapper api = new PaApi5Wrapper(ACCESS_KEY, SECRET_KEY);
    String resJson = api.searchItems(reqJson);
    System.out.println("=====Search for products by keyword:response=====");
    System.out.println(new JsonUtil().prettyPrint(resJson));
  }

  //Get product information from ASIN
  public static void getItems() throws Exception {

    String[] asinList = new String[]{"4391641585", "B010EB1HR4", "B0125SPF90", "B07V52KSGT"};

    //Request information
    Map<String, Object> req = new HashMap<>() {
      {
        put("PartnerTag", TRACKING_ID); //Store ID or tracking ID
        put("PartnerType", "Associates"); //Partner type
        put("ItemIds", asinList); //List of ASINs
        put("Resources", new String[]{ //Type of value to include in the response
          "ItemInfo.Title",
          "ItemInfo.ByLineInfo"
        });
      }
    };

    //Make request information a JSON string
    String reqJson = new JsonUtil().objectToJson(req);
    System.out.println("=====Get product information from ASIN:request=====");
    System.out.println(reqJson);

    // PA-Call API v5 and receive the result as a JSON string
    PaApi5Wrapper api = new PaApi5Wrapper(ACCESS_KEY, SECRET_KEY);
    String resJson = api.getItems(reqJson);
    System.out.println("=====Get product information from ASIN:response=====");
    System.out.println(new JsonUtil().prettyPrint(resJson));
  }
}

src/main/java/PaApi5Wrapper.java

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.time.Duration;
import java.util.Map;

/**
 * PA-API v5 wrapper class.
 */
public class PaApi5Wrapper {

  private static final String HOST = "webservices.amazon.co.jp"; // Amazon.co.jp Web API host
  private static final String REGION = "us-west-2"; // Amazon.co.jp in us-west-Specify 2

  private final String accessKey;
  private final String secretKey;

  /**
   *constructor.
   * @param accessKey Access key
   * @param secretKey secret key
   */
  public PaApi5Wrapper(String accessKey, String secretKey) {
    this.accessKey = accessKey;
    this.secretKey = secretKey;
  }

  /**
   *Search for products by keyword.
   * @param reqJson Request information JSON
   * @return response information JSON
   * @throws InterruptedException
   * @throws IOException
   * @throws NoSuchAlgorithmException
   * @throws InvalidKeyException
   * @throws URISyntaxException
   */
  public String searchItems(String reqJson) throws InterruptedException, IOException, NoSuchAlgorithmException, InvalidKeyException, URISyntaxException {
    String path = "/paapi5/searchitems";
    String target = "com.amazon.paapi5.v1.ProductAdvertisingAPIv1.SearchItems";
    return callApi(reqJson, path, target);
  }

  /**
   *Get product information from ASIN.
   * @param reqJson Request information JSON
   * @return response information JSON
   * @throws InterruptedException
   * @throws IOException
   * @throws NoSuchAlgorithmException
   * @throws InvalidKeyException
   * @throws URISyntaxException
   */
  public String getItems(String reqJson) throws InterruptedException, IOException, NoSuchAlgorithmException, InvalidKeyException, URISyntaxException {
    String path = "/paapi5/getitems";
    String target = "com.amazon.paapi5.v1.ProductAdvertisingAPIv1.GetItems";
    return callApi(reqJson, path, target);
  }

  /**
   * PA-Call API v5.
   * @param reqJson Request information JSON
   * @param path API entry point path
   * @param target Request destination service and data operations
   * @return response information JSON
   * @throws URISyntaxException
   * @throws InvalidKeyException
   * @throws NoSuchAlgorithmException
   * @throws IOException
   * @throws InterruptedException
   */
  public String callApi(String reqJson, String path, String target) throws URISyntaxException, InvalidKeyException, NoSuchAlgorithmException, IOException, InterruptedException {

    //Use the HTTP Client API officially introduced in Java 11

    //Build HTTP request information
    HttpRequest.Builder reqBuilder = HttpRequest.newBuilder()
      .uri(new URI("https://" + HOST + path)) //URL for API call
      .POST(HttpRequest.BodyPublishers.ofString(reqJson)) //Set parameters for API call
      .timeout(Duration.ofSeconds(10));

    //Get header information with signature information added
    AwsSignature4 awsv4Auth = new AwsSignature4(accessKey, secretKey, path, REGION, HOST, target);
    Map<String, String> signedHeaders = awsv4Auth.getHeaders(reqJson);

    //Set header in request information
    signedHeaders.remove("host"); //No Host header added(jdk.httpclient.allowRestrictedHeaders)
    for (Map.Entry<String, String> entrySet : signedHeaders.entrySet()) {
      reqBuilder.header(entrySet.getKey(), entrySet.getValue());
    }

    //Generate HTTP request information
    HttpRequest req = reqBuilder.build();

    //Call the API to get the result
    HttpClient client = HttpClient.newBuilder()
      .version(HttpClient.Version.HTTP_1_1)
      .connectTimeout(Duration.ofSeconds(10))
      .build();
    HttpResponse<String> res = client.send(req, HttpResponse.BodyHandlers.ofString());

    //Judge success / failure by status code
    if (res.statusCode() == 200) {
      return res.body();
    } else {
      throw new RuntimeException(res.body());
    }
  }
}

src/main/java/AwsSignature4.java

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.TimeZone;
import java.util.TreeMap;

/**
 *AWS signature version 4(AWS Signature Version 4)
 */
public class AwsSignature4 {

  private static final String SERVICE = "ProductAdvertisingAPI"; // PA-API
  private static final String HMAC_ALGORITHM = "AWS4-HMAC-SHA256";
  private static final String AWS_4_REQUEST = "aws4_request";

  private final String awsAccessKey;
  private final String awsSecretKey;
  private final String path;
  private final String region;
  private final String host;
  private final String target;

  /**
   *constructor.
   * @param awsAccessKey Access key
   * @param awsSecretKey Secret key
   * @param path API entry point path
   * @param region region
   * @param host API entry point path
   * @param target Request destination service and data operations
   */
  public AwsSignature4(
    String awsAccessKey, String awsSecretKey,
    String path, String region,
    String host, String target) {
    this.awsAccessKey = awsAccessKey;
    this.awsSecretKey = awsSecretKey;
    this.path = path;
    this.region = region;
    this.host = host;
    this.target = target;
  }

  /**
   *Returns header information for authentication.
   * @param payload Request information JSON
   * @header information for return authentication
   * @throws NoSuchAlgorithmException
   * @throws InvalidKeyException
   */
  public Map<String, String> getHeaders(String payload) throws NoSuchAlgorithmException, InvalidKeyException {
    //Base header
    TreeMap<String, String> headers = new TreeMap<>();
    headers.put("host", host);
    headers.put("content-type", "application/json; charset=utf-8");
    headers.put("content-encoding", "amz-1.0");
    headers.put("x-amz-target", target);
    //Timestamp used when creating a signature
    final Date date = new Date();
    headers.put("x-amz-date", getXAmzDateString(date));
    //Signed header(signed headers)
    String signedHeaders = createSignedHeaders(headers);
    //Regular request(canonical request)
    String canonicalRequest = createCanonicalRequest(path, headers, signedHeaders, payload);
    //Signature string(string to sign)
    String stringToSign = createStringToSign(date, region, canonicalRequest);
    //signature(signature)
    String signature = calculateSignature(awsSecretKey, date, region, stringToSign);
    //Authorization header value
    String authorization = buildAuthorizationString(awsAccessKey, region, signature, signedHeaders, date);
    headers.put("Authorization", authorization);
    return headers;
  }

  //Signed header(signed headers)
  private static String createSignedHeaders(TreeMap<String, String> headers) {
    StringBuilder signedHeaderBuilder = new StringBuilder();
    for (String key : headers.keySet()) {
      signedHeaderBuilder.append(key).append(";");
    }
    return signedHeaderBuilder.substring(0, signedHeaderBuilder.length() - 1);
  }

  //Regular request(canonical request)
  private static String createCanonicalRequest(String path, TreeMap<String, String> headers, String signedHeaders, String payload) throws NoSuchAlgorithmException {
    StringBuilder canonicalRequest = new StringBuilder();
    canonicalRequest.append("POST").append("\n");
    canonicalRequest.append(path).append("\n").append("\n");
    for (String key : headers.keySet()) {
      canonicalRequest.append(key).append(":").append(headers.get(key)).append("\n");
    }
    canonicalRequest.append("\n");
    canonicalRequest.append(signedHeaders).append("\n");
    canonicalRequest.append(sha256(payload));
    return canonicalRequest.toString();
  }

  //Signature string(string to sign)
  private static String createStringToSign(Date current, String region, String canonicalRequest) throws NoSuchAlgorithmException {
    return HMAC_ALGORITHM + "\n"
      + getXAmzDateString(current) + "\n"
      + getYMDString(current) + "/" + region + "/" + SERVICE + "/" + AWS_4_REQUEST + "\n"
      + sha256(canonicalRequest);
  }

  //signature(signature)
  private static String calculateSignature(String awsSecretKey, Date current, String region, String stringToSign) throws InvalidKeyException, NoSuchAlgorithmException {
    final String currentDate = getYMDString(current);
    byte[] signatureKey = getSigningKey(awsSecretKey, currentDate, region);
    byte[] signature = hmacSha256(signatureKey, stringToSign);
    return bytesToHex(signature);
  }

  //Signature key(signing key)
  private static byte[] getSigningKey(String key, String date, String region) throws InvalidKeyException, NoSuchAlgorithmException {
    //The result of each hash function is the input of the next hash function
    byte[] kSecret = ("AWS4" + key).getBytes(StandardCharsets.UTF_8);
    byte[] kDate = hmacSha256(kSecret, date);
    byte[] kRegion = hmacSha256(kDate, region);
    byte[] kService = hmacSha256(kRegion, SERVICE);
    byte[] kSigning = hmacSha256(kService, AWS_4_REQUEST);
    return kSigning;
  }

  //Authorization header value
  private static String buildAuthorizationString(String awsAccessKey, String region, String signature, String signedHeaders, Date current) {
    return HMAC_ALGORITHM + " "
      + "Credential=" + awsAccessKey + "/" + getYMDString(current) + "/" + region + "/" + SERVICE + "/" + AWS_4_REQUEST + ","
      + "SignedHeaders=" + signedHeaders + ","
      + "Signature=" + signature;
  }

  //Hash function SHA-256
  private static String sha256(String data) throws NoSuchAlgorithmException {
    MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
    messageDigest.update(data.getBytes(StandardCharsets.UTF_8));
    byte[] digest = messageDigest.digest();
    return String.format("%064x", new java.math.BigInteger(1, digest));
  }

  // HMAC-SHA256 function
  private static byte[] hmacSha256(byte[] key, String data) throws NoSuchAlgorithmException, InvalidKeyException {
    Mac mac = Mac.getInstance("HmacSHA256");
    mac.init(new SecretKeySpec(key, "HmacSHA256"));
    return mac.doFinal(data.getBytes(StandardCharsets.UTF_8));
  }

  //Convert binary values to hexadecimal representation
  private static String bytesToHex(byte[] data) {
    final char[] hexCode = "0123456789ABCDEF".toCharArray();
    StringBuilder r = new StringBuilder(data.length * 2);
    for (byte b : data) {
      r.append(hexCode[(b >> 4) & 0xF]);
      r.append(hexCode[(b & 0xF)]);
    }
    return r.toString().toLowerCase();
  }

  // x-amz-date / time string for date header(YYYYMMDD in UTC'T'HHMMSS'Z'ISO 8601 format)
  private static String getXAmzDateString(Date date) {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'"); // ISO 8601
    dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
    return dateFormat.format(date);
  }

  //Date string yyyyMMdd format
  private static String getYMDString(Date date) {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
    dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
    return dateFormat.format(date);
  }
}

src/main/java/JsonUtil.java

//Use the external library Jackson
import com.fasterxml.jackson.core.json.JsonWriteFeature;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;
import java.io.StringWriter;
import java.util.Map;

/**
 *JSON manipulation class.
 */
public class JsonUtil {

  /**
   *Generate a JSON string from the object.
   * @param obj object
   * @return JSON string
   * @throws IOException
   */
  public String objectToJson(Map<String, Object> obj) throws IOException {
    StringWriter out = new StringWriter();
    ObjectMapper mapper = new ObjectMapper();
    //Unicode escape except for ASCII characters
    mapper.configure(JsonWriteFeature.ESCAPE_NON_ASCII.mappedFeature(), true);
    mapper.writerWithDefaultPrettyPrinter().writeValue(out, obj);
    return out.toString();
  }

  /**
   *Make JSON easy to read.
   * @param json JSON string
   * @return A JSON string that is easy to read
   * @throws IOException
   */
  public String prettyPrint(String json) throws IOException {
    StringWriter out = new StringWriter();
    ObjectMapper mapper = new ObjectMapper();
    mapper.writerWithDefaultPrettyPrinter().writeValue(out, mapper.readValue(json, Map.class));
    return out.toString();
  }
}

Sample code execution result

Execution environment: macOS Catalina + Java 15 (AdoptOpenJDK 15) + Gradle 6.6.1

$ gradle run
Starting a Gradle Daemon (subsequent builds will be faster)

> Task :run
=====Search for products by keyword:request=====
{
  "PartnerType" : "Associates",
  "PartnerTag" : "XXXXX-22",
  "Keywords" : "\u30B7\u30A7\u30A4\u30AF\u30B9\u30D4\u30A2",
  "SearchIndex" : "All",
  "ItemCount" : 3,
  "Resources" : [ "ItemInfo.Title", "ItemInfo.ByLineInfo", "ItemInfo.ProductInfo", "ItemInfo.ProductInfo", "Images.Primary.Large", "Images.Primary.Medium", "Images.Primary.Small" ]
}
=====Search for products by keyword:response=====
{
  "SearchResult" : {
    "Items" : [ {
      "ASIN" : "B06ZZH149Y",
      "DetailPageURL" : "https://www.amazon.co.jp/dp/B06ZZH149Y?tag=XXXXX-22&linkCode=osi&th=1&psc=1",
      "Images" : {
        "Primary" : {
          "Large" : {
            "Height" : 500,
            "URL" : "https://m.media-amazon.com/images/I/41Ms+C0NwNL.jpg ",
            "Width" : 311
          },
          "Medium" : {
            "Height" : 160,
            "URL" : "https://m.media-amazon.com/images/I/41Ms+C0NwNL._SL160_.jpg ",
            "Width" : 100
          },
          "Small" : {
            "Height" : 75,
            "URL" : "https://m.media-amazon.com/images/I/41Ms+C0NwNL._SL75_.jpg ",
            "Width" : 47
          }
        }
      },
      "ItemInfo" : {
        "ByLineInfo" : {
          "Contributors" : [ {
            "Locale" : "ja_JP",
            "Name" : "Shoichiro Kawai",
            "Role" : "Written by",
            "RoleType" : "author"
          } ],
          "Manufacturer" : {
            "DisplayValue" : "Shodensha",
            "Label" : "Manufacturer",
            "Locale" : "ja_JP"
          }
        },
        "ProductInfo" : {
          "IsAdultProduct" : {
            "DisplayValue" : false,
            "Label" : "IsAdultProduct",
            "Locale" : "en_US"
          },
          "ReleaseDate" : {
            "DisplayValue" : "2017-04-21T00:00:00.000Z",
            "Label" : "ReleaseDate",
            "Locale" : "en_US"
          }
        },
        "Title" : {
          "DisplayValue" : "All Shakespeare works read in the synopsis(Shodensha Shinsho)",
          "Label" : "Title",
          "Locale" : "ja_JP"
        }
      }
    }, {
      "ASIN" : "B015BY1Q6Q",
      "DetailPageURL" : "https://www.amazon.co.jp/dp/B015BY1Q6Q?tag=XXXXX-22&linkCode=osi&th=1&psc=1",
      "Images" : {
        "Primary" : {
          "Large" : {
            "Height" : 500,
            "URL" : "https://m.media-amazon.com/images/I/516XD+o35gL.jpg ",
            "Width" : 375
          },
          "Medium" : {
            "Height" : 160,
            "URL" : "https://m.media-amazon.com/images/I/516XD+o35gL._SL160_.jpg ",
            "Width" : 120
          },
          "Small" : {
            "Height" : 75,
            "URL" : "https://m.media-amazon.com/images/I/516XD+o35gL._SL75_.jpg ",
            "Width" : 56
          }
        }
      },
      "ItemInfo" : {
        "ByLineInfo" : {
          "Contributors" : [ {
            "Locale" : "ja_JP",
            "Name" : "Mel Gibson",
            "Role" : "Appearance",
            "RoleType" : "actor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Glenn Close",
            "Role" : "Appearance",
            "RoleType" : "actor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Alan Bates",
            "Role" : "Appearance",
            "RoleType" : "actor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Paul Scofield",
            "Role" : "Appearance",
            "RoleType" : "actor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Franco Zeffirelli",
            "Role" : "directed by",
            "RoleType" : "director"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Christopher Devore",
            "Role" : "Writer",
            "RoleType" : "writer"
          } ]
        },
        "ProductInfo" : {
          "IsAdultProduct" : {
            "DisplayValue" : false,
            "Label" : "IsAdultProduct",
            "Locale" : "en_US"
          },
          "ReleaseDate" : {
            "DisplayValue" : "2015-09-16T00:00:00.000Z",
            "Label" : "ReleaseDate",
            "Locale" : "en_US"
          }
        },
        "Title" : {
          "DisplayValue" : "Hamlet(Subtitled version)",
          "Label" : "Title",
          "Locale" : "ja_JP"
        }
      }
    }, {
      "ASIN" : "B07WPXRT5W",
      "DetailPageURL" : "https://www.amazon.co.jp/dp/B07WPXRT5W?tag=XXXXX-22&linkCode=osi&th=1&psc=1",
      "Images" : {
        "Primary" : {
          "Large" : {
            "Height" : 375,
            "URL" : "https://m.media-amazon.com/images/I/51CnJBKwu5L.jpg ",
            "Width" : 500
          },
          "Medium" : {
            "Height" : 120,
            "URL" : "https://m.media-amazon.com/images/I/51CnJBKwu5L._SL160_.jpg ",
            "Width" : 160
          },
          "Small" : {
            "Height" : 56,
            "URL" : "https://m.media-amazon.com/images/I/51CnJBKwu5L._SL75_.jpg ",
            "Width" : 75
          }
        }
      },
      "ItemInfo" : {
        "ByLineInfo" : {
          "Contributors" : [ {
            "Locale" : "ja_JP",
            "Name" : "Mark Benton",
            "Role" : "Appearance",
            "RoleType" : "actor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Joe Joiner",
            "Role" : "Appearance",
            "RoleType" : "actor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Amber Aga",
            "Role" : "Appearance",
            "RoleType" : "actor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Richard Sainy",
            "Role" : "directed by",
            "RoleType" : "director"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Ian Barber",
            "Role" : "directed by",
            "RoleType" : "director"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Will Trotter",
            "Role" : "Produced",
            "RoleType" : "producer"
          } ]
        },
        "ProductInfo" : {
          "IsAdultProduct" : {
            "DisplayValue" : false,
            "Label" : "IsAdultProduct",
            "Locale" : "en_US"
          }
        },
        "Title" : {
          "DisplayValue" : "Episode 1",
          "Label" : "Title",
          "Locale" : "ja_JP"
        }
      }
    } ],
    "SearchURL" : "https://www.amazon.co.jp/s?k=%E3%82%B7%E3%82%A7%E3%82%A4%E3%82%AF%E3%82%B9%E3%83%94%E3%82%A2&rh=p_n_availability%3A-1&tag=XXXXX-22&linkCode=osi",
    "TotalResultCount" : 146
  }
}
=====Get product information from ASIN:request=====
{
  "PartnerType" : "Associates",
  "PartnerTag" : "XXXXX-22",
  "Resources" : [ "ItemInfo.Title", "ItemInfo.ByLineInfo" ],
  "ItemIds" : [ "4391641585", "B010EB1HR4", "B0125SPF90", "B07V52KSGT" ]
}
=====Get product information from ASIN:response=====
{
  "ItemsResult" : {
    "Items" : [ {
      "ASIN" : "4391641585",
      "DetailPageURL" : "https://www.amazon.co.jp/dp/4391641585?tag=XXXXX-22&linkCode=ogi&th=1&psc=1",
      "ItemInfo" : {
        "ByLineInfo" : {
          "Contributors" : [ {
            "Locale" : "ja_JP",
            "Name" : "San-X",
            "Role" : "Supervision",
            "RoleType" : "consultant_editor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Shufu to Seikatsusha",
            "Role" : "Edit",
            "RoleType" : "editor"
          } ],
          "Manufacturer" : {
            "DisplayValue" : "Shufu to Seikatsusha",
            "Label" : "Manufacturer",
            "Locale" : "ja_JP"
          }
        },
        "Title" : {
          "DisplayValue" : "Sumikko Gurashi Test Official Guidebook Sumikko Gurashi Encyclopedia(Life series)",
          "Label" : "Title",
          "Locale" : "ja_JP"
        }
      }
    }, {
      "ASIN" : "B010EB1HR4",
      "DetailPageURL" : "https://www.amazon.co.jp/dp/B010EB1HR4?tag=XXXXX-22&linkCode=ogi&th=1&psc=1",
      "ItemInfo" : {
        "ByLineInfo" : {
          "Brand" : {
            "DisplayValue" : "Hostess Entertainmen",
            "Label" : "Brand",
            "Locale" : "ja_JP"
          },
          "Contributors" : [ {
            "Locale" : "ja_JP",
            "Name" : "Halloween",
            "Role" : "Artist",
            "RoleType" : "artist"
          } ],
          "Manufacturer" : {
            "DisplayValue" : "hostess",
            "Label" : "Manufacturer",
            "Locale" : "ja_JP"
          }
        },
        "Title" : {
          "DisplayValue" : "Guardian Shinden Chapter 2<Expanded Edition>(Remaster)",
          "Label" : "Title",
          "Locale" : "ja_JP"
        }
      }
    }, {
      "ASIN" : "B0125SPF90",
      "DetailPageURL" : "https://www.amazon.co.jp/dp/B0125SPF90?tag=XXXXX-22&linkCode=ogi&th=1&psc=1",
      "ItemInfo" : {
        "ByLineInfo" : {
          "Brand" : {
            "DisplayValue" : "Rubies Japan(RUBIE'S JAPAN)",
            "Label" : "Brand",
            "Locale" : "ja_JP"
          },
          "Manufacturer" : {
            "DisplayValue" : "Rubies Japan(RUBIE'S JAPAN)",
            "Label" : "Manufacturer",
            "Locale" : "ja_JP"
          }
        },
        "Title" : {
          "DisplayValue" : "Halloween Rocking Pumpkin Home decoration accessory H 130cm",
          "Label" : "Title",
          "Locale" : "ja_JP"
        }
      }
    }, {
      "ASIN" : "B07V52KSGT",
      "DetailPageURL" : "https://www.amazon.co.jp/dp/B07V52KSGT?tag=XXXXX-22&linkCode=ogi&th=1&psc=1",
      "ItemInfo" : {
        "ByLineInfo" : {
          "Contributors" : [ {
            "Locale" : "ja_JP",
            "Name" : "Lian Reese",
            "Role" : "Appearance",
            "RoleType" : "actor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Jamie Lee Curtis",
            "Role" : "Appearance",
            "RoleType" : "actor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Will Patton",
            "Role" : "Appearance",
            "RoleType" : "actor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Judy Greer",
            "Role" : "Appearance",
            "RoleType" : "actor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Virginia Gardner",
            "Role" : "Appearance",
            "RoleType" : "actor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Jefferson Hall",
            "Role" : "Appearance",
            "RoleType" : "actor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Andy Mattichuck",
            "Role" : "Appearance",
            "RoleType" : "actor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Nick Castle",
            "Role" : "Appearance",
            "RoleType" : "actor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "James Jude Courtney",
            "Role" : "Appearance",
            "RoleType" : "actor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Hulk Birginer",
            "Role" : "Appearance",
            "RoleType" : "actor"
          }, {
            "Locale" : "ja_JP",
            "Name" : "David Gordon Green",
            "Role" : "directed by",
            "RoleType" : "director"
          }, {
            "Locale" : "ja_JP",
            "Name" : "David Gordon Green",
            "Role" : "Writer",
            "RoleType" : "writer"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Danny McBride",
            "Role" : "Writer",
            "RoleType" : "writer"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Jeff Floodley",
            "Role" : "Writer",
            "RoleType" : "writer"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Marek Akkad",
            "Role" : "Produced",
            "RoleType" : "producer"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Jason Blum",
            "Role" : "Produced",
            "RoleType" : "producer"
          }, {
            "Locale" : "ja_JP",
            "Name" : "Bill block",
            "Role" : "Produced",
            "RoleType" : "producer"
          } ]
        },
        "Title" : {
          "DisplayValue" : "Halloween(Subtitled version)",
          "Label" : "Title",
          "Locale" : "ja_JP"
        }
      }
    } ]
  }
}

BUILD SUCCESSFUL in 13s
2 actionable tasks: 2 executed

Reference material

-PA-API v5 Migration Guide --Associate Central

Recommended Posts

Call Amazon Product Advertising API 5.0 (PA-API v5) in Java
Use the Amazon Product Advertising API 5.0 (PA-API v5) SDK (paapi5-java-sdk-1.0.0)
Call the Windows Notification API in Java
Zabbix API in Java
Sample code to call Yahoo! Shopping Product Search (v3) API in Spring RestTemplate
Java Stream API in 5 minutes
Call this cat API of Metadata Co., Ltd. in Java.
How to call and use API in Java (Spring Boot)
Generate AWS Signature V4 in Java and request an API
Implement reCAPTCHA v3 in Java / Spring
Generate CloudStack API URL in Java
Hit Zaim's API (OAuth 1.0) in Java
Parsing the COTOHA API in Java
Sample code to call the Yahoo! Local Search API in Java
Call TensorFlow Java API from Scala
JPA (Java Persistence API) in Eclipse
Call the super method in Java
Sample code to call Yahoo! Shopping Product Search (v3) API with HTTP Client API officially introduced from Java 11
I tried using Elasticsearch API in Java
Implement API Gateway Lambda Authorizer in Java Lambda
Studying Java 8 (date API in java.time package)
Call GitHub API from Java Socket API part2
Call Java method from JavaScript executed in Java
Try using the Stream API in Java
Try using JSON format API in Java
Call Visual Recognition in Watson Java SDK
[Java] New Yahoo! Product Search API Implementation
Call API [Call]
I tried to make a product price comparison tool of Amazon around the world with Java, Amazon Product Advertising API, Currency API (2017/01/29)
ChatWork4j for using the ChatWork API in Java
[Java] API creation using Jerjey (Jax-rs) in eclipse
Java method call from RPG (method call in own class)
[Java] Create something like a product search API
Send email using Amazon SES SMTP in Java
Try using GCP's Cloud Vision API in Java
Try using the COTOHA API parsing in Java