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.

0. Example of Java request.


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;
   }
}

1. Get list of your hotels.

Request


{
	"action" : "getMyHotels"
}

Response

{
	"hotels": [{
		"name": "HOTEL LISANJ  2* (Istria. Novi Vinodolski)",
		"rating": "2*",
		"id": "102610003350"
	}, {
		"name": "VILLA NORA  3* (Middle Dalmatija. Hvar)",
		"rating": "3*",
		"id": "102610006378"
	}]
}

2. Get list of the hotel rooms.

Request


{
	"action" : "getMyRooms",
	"hotelId" : "102610003350"
}

Response


{
	"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"
	}]
}

3. Set stop sale

Request


{
	"action": "setStop",
	"hotelId": "102610003350",
	"dBeg": "01.12.2017",
	"dEnd": "10.12.2017",
	"rooms": [
		"104610009952",
		"104610009951"
	]
}

Response

Example 1:


{
	"status": true,
	"errors": [],
	"id": "107410569754"
}

Example 2:


{
	"status": false,
	"errors": ["wrong date format 2017-12-01", "Wrong hotel 10261000335"],
	"id": ""
}

4. Get list of stop sales by hotel.

Request


{
	"action": "getMyStops",
	"hotelId": "102610003350",
}

Response


{
	"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"
		}]
	}]
}

5. Delete stop sale.

Request


{
	"action": "delStop",
	"id": "107410569760",
}

Response


{
	"success":true,
	"message":""
}

6. Set Allocation.

Request


{
	"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


{
	"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.

7. Get Allocations.

Request


{
	"action": "getMyAllocations",
	"roomTypeId" : "102110003351",
	"dBeg" : "01.12.2017",
	"dEnd" : "10.12.2017"
}

Response


{
	"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
	}]
}