API for charter flights

1. Connection steps 1.1. Register on Biblio-Globus site 1.2. Message our support team to get information about connection 1.3. Integration development with Biblio-Globus services 1.4. Requesting permissions for connection to start testing 1.5. Testing. Request to erase created tours. 1.6. Production deployment 2. Services description 2.1. Authorisation 2.2. Biblio-Globus system references 2.3. Requesting flights timetable 2.4. Requesting route prices 2.5. Preparing for booking 2.6. Booking and creating a tour 2.7. Requesting information from the tour 2.8. Tour payment using a deposit 3. Example of authorisation service

1. Connection steps

1.1. Register on Biblio-Globus site

login page
https://www.bgoperator.ru/texts/api/load-xml-prices-en.html#name11
for agencies
https://www.bgoperator.ru/docs.shtml?id_flt=1000522#сoperation
for private
https://www.bgoperator.ru/docs.shtml?id_flt=1000523#personal_register

1.2. Message our support team to get information about connection

you are here now

1.3. Integration development with Biblio-Globus services

1.4. Requesting permissions for connection to start testing from our support team

in reply you’ll see safe dates and destinations for testing

1.5. Testing. Request to erase your created tours from our support team

in reply you’ll see confirmation, that created tours are erased. And permits for production step

1.6. Production deployment

2. Services description

2.1. Authorisation

https://www.bgoperator.ru/texts/api/load-xml-prices-en.html#name12
https://www.bgoperator.ru/texts/api/load-xml-prices-en.html#name13

2.2. Biblio-Globus system references

some requests need an ID from Biblio-Globus system, look for them in Biblio-Globus system references
https://www.bgoperator.ru/texts/api/load-xml-prices-en.html#name2
a list of available airports and airlines
https://export.bgoperator.ru/yandex?action=avia

2.3. Requesting flights timetable

An example link:

https://export.bgoperator.ru/yandex?action=flights&aircountry1=....&aircountry2=....&data=20.02.2019

for aircountry1 and aircountry2 you can use a Biblio-Globus countries’ ID or two-letter ISO-country codes

2.4. Requesting route prices

https://www.bgoperator.ru/texts/api/load-xml-prices-en.html#name7

2.5. Preparing for booking

http://export.bgoperator.ru/api/tour-api.html#createaviatour1
error codes
http://export.bgoperator.ru/api/tour-api.html#errors

2.6. Booking and creating a tour

http://export.bgoperator.ru/api/tour-api.html#createaviatour2
error codes
http://export.bgoperator.ru/api/tour-api.html#errors

2.7. Requesting information from the tour

http://export.bgoperator.ru/requests-tozaya-in-xml.html#singletozaya

2.8. Tour payment using a deposit

discussed on request

3. Example of authorisation service

List of services' versions

Java 1.7
HttpClient 4.5.3 - versions lower than 4.5 don’t support session cookies
HttpCore 4.4.6

Example code

		

	public static void main(String[] args) throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException {
		HttpClient client = getHTTPSClient();
		HttpPost httpPost = new HttpPost("https://login.bgoperator.ru/auth");

		ArrayList postParameters;
		postParameters = new ArrayList();
		postParameters.add(new BasicNameValuePair("login", login));
		postParameters.add(new BasicNameValuePair("pwd", password));
		httpPost.setEntity(new UrlEncodedFormEntity(postParameters));

		Reader reader = doRequest(client, httpPost);

		//example of cost GET-request 
		HttpGet httpGet = new HttpGet("http://export.bgoperator.ru/site?action=biletblock&vr0=1&vr1=1&vr2=0&idfrom=MOW&idto=BCN&datefrom=2017-07-09&dateto=2017-07-23&class=Y&cur=EUR");
		reader = doRequest(client, httpGet);

		/*
		//example of booking POST-request
		httpPost = new HttpPost("https://www.bgoperator.ru/zayavkaapi?prx=104499999900000094&action=createaviatour");
		httpPost.setEntity(new StringEntity("\n" +
		      .... 
		        + ""));
		reader = doRequest(client, httpPost);
		*/

		StringBuilder res = new StringBuilder();
		char[] buf = new char[10000];
		int len = 0;
		while ((len = reader.read(buf))==10000) {
		    res.append(buf);
		} if (len>0) res.append(buf,0, len);
			System.out.println(res);
	}

	public static HttpClient getHTTPSClient() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException {
		org.apache.http.ssl.SSLContextBuilder context_b = SSLContextBuilder.create();
		context_b.loadTrustMaterial(new org.apache.http.conn.ssl.TrustStrategy() {

			@Override
			public boolean isTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
				return true;
			}
		});
		SSLContext ssl_context = context_b.build();
		org.apache.http.conn.ssl.SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(ssl_context,
                new org.apache.http.conn.ssl.NoopHostnameVerifier());

		HttpClientBuilder builder = HttpClients.custom().setSSLSocketFactory(sslSocketFactory);

		HttpClient client = builder.build();
		return client;
	}

	private static Reader doRequest(HttpClient client, HttpRequestBase method) throws IOException {
		//SocketTimeoutException or ConnectException
		try {
			HttpResponse response = client.execute(method);
		    int returnCode = response.getStatusLine().getStatusCode();

		if (returnCode == HttpStatus.SC_NOT_IMPLEMENTED) 
                System.err.println("The Post method is not implemented by this URI");
		else return new InputStreamReader(response.getEntity().getContent());
		}
		catch (Exception ex) {
		ex.printStackTrace(System.out);
        }
        return null;
    }