Building the API client library requires Maven to be installed.
To install the API client library to your local Maven repository, simply execute:
mvn install
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn deploy
Refer to the official documentation for more information.
Add this dependency to your project's POM:
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-java-client</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
Add this dependency to your project's build file:
compile "io.swagger:swagger-java-client:1.0.0"
At first generate the JAR by executing:
mvn package
Then manually install the following JARs:
- target/swagger-java-client-1.0.0.jar
- target/lib/*.jar
Please follow the installation instruction and execute the following Java code:
import hotelspro_client.*;
import hotelspro_client.auth.*;
import hotelspro_client.model.*;
import hotelspro_client.api.DefaultApi;
import java.io.File;
import java.util.*;
public class DefaultApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");
DefaultApi apiInstance = new DefaultApi();
String productCode = "productCode_example"; // String | product code that returned in Search(or Hotel Availability) Response
try {
AvailabilityResponse result = apiInstance.availabilityProductCodeGet(productCode);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#availabilityProductCodeGet");
e.printStackTrace();
}
}
}
All URIs are relative to https://localhost/api/v2
Class | Method | HTTP request | Description |
---|---|---|---|
DefaultApi | availabilityProductCodeGet | GET /availability/{product_code} | Availability with Product Code |
DefaultApi | bookProvisionCodePost | POST /book/{provision_code} | Book with Provision Code |
DefaultApi | bookingsBookingCodeGet | GET /bookings/{booking_code} | Get Booking Detail |
DefaultApi | bookingsGet | GET /bookings/ | Get Booking List |
DefaultApi | cancelBookingCodePost | POST /cancel/{booking_code} | Cancel Booking with Booking Code |
DefaultApi | hotelAvailabilityGet | GET /hotel-availability/ | Hotel Availability with Hotel Code and Search Code |
DefaultApi | provisionProductCodePost | POST /provision/{product_code} | Provision with Product Code |
DefaultApi | searchPost | POST /search/ | Search with Hotel Code(Hotel Code List) or Destination Code or Geolocation |
- AvailabilityResponse
- BookResponse
- BookResponseConfirmationNumbers
- BookResponseHotelPaymentInfo
- BookResponseRooms
- BookingListResponse
- CancelResponse
- Error
- ErrorDetail
- ErrorDetails
- ErrorDetailsDetail
- HotelAvailabilityResponse
- Pax
- Policy
- Product
- ProvisionResponse
- Results
- Room
- SearchResponse
Authentication schemes defined for the API:
- Type: HTTP basic authentication
It's recommended to create an instance of ApiClient
per thread in a multithreaded environment to avoid any potential issues.