このコンテンツはこの言語ではまだ利用できません

Setting up the XAP SDK

Software development kits make integration simple so you can quickly get products to market

1. Set up a Java development environment

Your development environment needs to have Java 8 or later. You can use Apache Maven or Gradle to configure SDK dependencies for your projects.


2. Create a service client and configure credentials

All API requests must be authenticated using your API client ID and secret. Create a XapClient and configure it with your credentials.

XapClient xapClient =
    XapClient
        .builder()
        .key("KEY")
        .secret("SECRET")
        .build();

(Optional) 2.1. Configure timeout

The service client can be configured with different timeouts for request, connection, and socket.


2.1.1. Configure request timeout

Request timeout is the time period from the start of the request to the completion of the response. The default value is infinite (no timeout).

XapClient xapClient=
    XapClient
        .builder()
        .requestTimeout(90_000) // 90 seconds
        .key("KEY")
        .secret("SECRET")
        .build();

2.1.2. Configure connection timeout

Connection timeout is the time period from the start of the request to the establishment of the connection with the server. The default value is 10000 milliseconds (10 seconds).

XapClient xapClient=
    XapClient
        .builder()
        .connectionTimeout(30_000) // 30 seconds
        .key("KEY")
        .secret("SECRET")
        .build();

2.1.3. Configure socket timeout

Socket timeout is the maximum period of inactivity between two consecutive data packets when exchanging data with a server. The default value is 15000 milliseconds (15 seconds).

XapClient xapClient=
    XapClient
        .builder()
        .socketTimeout(30_000) // 30 seconds
        .key("KEY")
        .secret("SECRET")
        .build();

3. Build request operation and make API calls

Build your request object using the classes defined in the SDK, and use the service client to make the API call using it.

GetLodgingListingsOperationParams getLodgingListingsOperationParams
        = GetLodgingListingsOperationParams
            .builder()
            .partnerTransactionId("PARTNER TRANSACTION ID")
            .locationKeyword("LOCATION KEYWORD")
            .build();

GetLodgingListingsOperation getLodgingListingsOperation =
        new GetLodgingListingsOperation(getLodgingListingsOperationParams);

Response<HotelListingsResponse> hotelListingsResponse =
        client.execute(getLodgingListingsOperation);

Need more information? Check out our usage examples. To get better insight into your API calls, configure logging.

このページは役に立ちましたか ?
このコンテンツに改善が必要な点があれば、
サービス向上にご協力いただきありがとうございます。