Request URL is http://internal.bgoperator.ru/accomodation?task=api.
You should get your login and password from our support team. Email us 112@bgoperator.com. To access live or test system you should send list of your IP addresses to our support team.
public static String postToURL(String url, String message) throws IOException, RuntimeException {
DefaultHttpClient httpClient = new DefaultHttpClient();
String username = "user";
String password = "password";
String host = "host";
httpClient.getCredentialsProvider().setCredentials(new AuthScope(host, AuthScope.ANY_PORT),
new UsernamePasswordCredentials(username, password));
HttpPost postRequest = new HttpPost(url);
StringEntity input = new StringEntity(message);
input.setContentType("application/json");
postRequest.setEntity(input);
try {
HttpResponse response = httpClient.execute(postRequest);
if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("Failed : HTTP error code : "
+ response.getStatusLine().getStatusCode());
}
BufferedReader br = new BufferedReader(
new InputStreamReader((response.getEntity().getContent())));
String output = "";
StringBuffer totalOutput = new StringBuffer();
while ((output = br.readLine()) != null) {
totalOutput.append(output);
}
return totalOutput.toString();
} catch (Exception e){
return "Exception "+e.getMessage()+" URL = "+url;
}
}
{
"action" : "getMyHotels"
}
{
"hotels": [{
"name": "HOTEL LISANJ 2* (Istria. Novi Vinodolski)",
"rating": "2*",
"id": "102610003350"
}, {
"name": "VILLA NORA 3* (Middle Dalmatija. Hvar)",
"rating": "3*",
"id": "102610006378"
}]
}
{
"action" : "getMyRooms",
"hotelId" : "102610003350"
}
{
"rooms": [{
"id": "104610009952",
"name": "STANDARD BALCONY PARK SIDE FB",
"roomTypeId": "102110003355",
"roomTypeName": "STANDARD BALCONY PARK SIDE"
}, {
"id": "104610009951",
"name": "STANDARD BALCONY PARK SIDE HB",
"roomTypeId": "102110003355",
"roomTypeName": "STANDARD BALCONY PARK SIDE"
}, {
"id": "104610009950",
"name": "STANDARD BALCONY PARK SIDE BB",
"roomTypeId": "102110003355",
"roomTypeName": "STANDARD BALCONY PARK SIDE"
}, {
"id": "104610009936",
"name": "STANDARD BALCONY SEA SIDE FB",
"roomTypeId": "102110003351",
"roomTypeName": "STANDARD BALCONY SEA SIDE"
}, {
"id": "104610009935",
"name": "STANDARD BALCONY SEA SIDE HB",
"roomTypeId": "102110003351",
"roomTypeName": "STANDARD BALCONY SEA SIDE"
}, {
"id": "104610009934",
"name": "STANDARD BALCONY SEA SIDE BB",
"roomTypeId": "102110003351",
"roomTypeName": "STANDARD BALCONY SEA SIDE"
}]
}
{
"action": "setStop",
"hotelId": "102610003350",
"dBeg": "01.12.2017",
"dEnd": "10.12.2017",
"rooms": [
"104610009952",
"104610009951"
]
}
{
"status": true,
"errors": [],
"id": "107410569754"
}
{
"status": false,
"errors": ["wrong date format 2017-12-01", "Wrong hotel 10261000335"],
"id": ""
}
{
"action": "getMyStops",
"hotelId": "102610003350",
}
{
"stops": [{
"id": "107410569760",
"hotelId": "102610003350",
"dBeg": "01.12.2017",
"dEnd": "10.12.2017",
"rooms": [{
"id": "104610009951",
"name": "STANDARD BALCONY PARK SIDE HB"
}, {
"id": "104610009952",
"name": "STANDARD BALCONY PARK SIDE FB"
}]
}]
}
{
"action": "delStop",
"id": "107410569760",
}
{
"success":true,
"message":""
}
{
"action": "setAllocation",
"hotelId" : "102610003350",
"allocations": [{
"date": "04.12.2017",
"roomTypeId": "102110003351",
"allocation": -1,
"release": 9
}, {
"date": "05.12.2017",
"roomTypeId": "10211000335",
"allocation": 4,
"release": 9
},
{
"date": "06.12.2017",
"roomTypeId": "102110003351",
"allocation": 7
}
]
}
{
"response": [{
"success": false,
"date": "04.12.2017",
"roomTypeId": "102110003351",
"errors": ["incorrect values"]
}, {
"success": false,
"date": "05.12.2017",
"roomTypeId": "10211000335",
"errors": ["Wrong roomId", "Wrong roomTypeId for this hotel"]
}, {
"success": true,
"date": "06.12.2017",
"roomTypeId": "102110003351",
"errors": []
}]
}
Release days is optional.If you want to remove allocation just send allocation=0
.
{
"action": "getMyAllocations",
"roomTypeId" : "102110003351",
"dBeg" : "01.12.2017",
"dEnd" : "10.12.2017"
}
{
"allocations": [{
"date": "04.12.2017",
"allocation": 9,
"usedVolume": 0,
"release": 9
}, {
"date": "05.12.2017",
"allocation": 4,
"usedVolume": 0,
"release": 9
}, {
"date": "06.12.2017",
"allocation": 7,
"usedVolume": 0,
"release": 0
}, {
"date": "07.12.2017",
"allocation": 5,
"usedVolume": 0,
"release": 5
}]
}