1. Get the Amazon official SDK

For those of you who don’t, click here

The official documentation

2. The results are as follows

@Test public void test01(){ //1. Connect to spApi / / 1.1 configure your own AWS credentials AWSAuthenticationCredentials AWSAuthenticationCredentials = AWSAuthenticationCredentials.builder() .accessKeyId("you accessKeyId") .secretKey("you secretKey") .region("us-east-1") .build(); / / 1.2 configure your AWS credentials provider AWSAuthenticationCredentialsProvider AWSAuthenticationCredentialsProvider = AWSAuthenticationCredentialsProvider. Builder (). RoleArn (" you roleArn ") / / IAM role. RoleSessionName (" you roleSessionName ") .build(); / / 1.3 configuration document of LWA LWAAuthorizationCredentials LWAAuthorizationCredentials = LWAAuthorizationCredentials. Builder () .clientId("you clientId") .clientSecret("you clientSecret") .refreshToken("you refreshToken") . The endpoint (" https://api.amazon.com/auth/o2/token ") / / LWA authentication server URI. The build (); OrdersV0Api ordersV0Api = new OrdersV0Api.Builder().awsAuthenticationCredentials(awsAuthenticationCredentials) .awsAuthenticationCredentialsProvider(awsAuthenticationCredentialsProvider) . LwaAuthorizationCredentials (lwaAuthorizationCredentials) / / the test for the test environment .endpoint("https://sandbox.sellingpartnerapi-na.amazon.com") .build();

3. Refer to Ordersv0.json file to send the test request

OrdersV0.json

Please select the content with the X-Amazon-SPDS-Sandbox-Behaviors as the test request.

4. In field

4.1 getOrders

Request Request:

Request code:

List<String> marketplaceIds = Arrays.asList("ATVPDKIKX0DER");
GetOrdersResponse orders = null;
try {
  orders = ordersV0Api.getOrders(marketplaceIds, "TEST_CASE_200", null, null, null, null, null, null, null, null, null, null, null, null);
} catch (ApiException e) {
  e.printStackTrace();
  System.out.println("orders.getErrors().toString() = " + orders.getErrors().toString());
}
System.out.println("orders.getPayload().getOrders() = " + orders.getPayload().getOrders());

Result of request:

4.2 getOrder

Request Request:

Request code:

GetOrderResponse order = null;
try {
  order = ordersV0Api.getOrder("TEST_CASE_200");
} catch (ApiException e) {
  e.printStackTrace();
}
System.out.println("order.getPayload() = " + order.getPayload());

Result of request:

4.3 getOrderBuyerInfo

Request Request:

Request code:

GetOrderBuyerInfoResponse order = null;
        try {
            order = ordersV0Api.getOrderBuyerInfo("TEST_CASE_200");
        } catch (ApiException e) {
            e.printStackTrace();
        }
        System.out.println("order.getPayload() = " + order.getPayload());

Result of request:

4.4 getOrderAddress

Request Request:

Request code:

GetOrderAddressResponse order = null;
try {
    order = ordersV0Api.getOrderAddress("TEST_CASE_200");
} catch (ApiException e) {
    e.printStackTrace();
}
System.out.println("order.getPayload() = " + order.getPayload());

Result of request:

4.5 getOrderItems

Request Request:

Request code:

GetOrderItemsResponse order = null;
try {
  order = ordersV0Api.getOrderItems("TEST_CASE_200",null);
} catch (ApiException e) {
  e.printStackTrace();
}
System.out.println("order.getPayload() = " + order.getPayload());

Result of request:

4.6 getOrderItemsBuyerInfo

Request Request:

Request code:

GetOrderItemsBuyerInfoResponse order = null;
try {
  order = ordersV0Api.getOrderItemsBuyerInfo("TEST_CASE_200",null);
} catch (ApiException e) {
  e.printStackTrace();
}
System.out.println("order.getPayload() = " + order.getPayload());

Result of request:

All six interfaces to this official document have been tested!