Wiki source code of 1. GetDestinationCountries
Last modified by Giorgi Mdivnishvili on 2024/04/11 15:47
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{box cssClass="floatinginfobox" title="**Contents**"}} | ||
2 | |||
3 | |||
4 | {{toc/}} | ||
5 | {{/box}} | ||
6 | |||
7 | = Method Description = | ||
8 | |||
9 | |||
10 | The GetDestinationCountries method is a utility function provided by Nugios, designed to retrieve a comprehensive list of destination countries available within the system. This method facilitates access to the entire catalog of destination countries supported by Nugios. | ||
11 | |||
12 | |||
13 | **Notes:** | ||
14 | |||
15 | * The list of destination countries provided by GetDestinationCountries is sourced directly from Nugios and may be subject to updates and changes over time. | ||
16 | * The information returned by this method can be utilized for various purposes such as generating country dropdowns in user interfaces, validating user inputs, or conducting analyses based on geographical distribution. | ||
17 | |||
18 | == Endpoint URL - [GET] == | ||
19 | |||
20 | {{info}} | ||
21 | [[https:~~/~~/integration.kazunion.com/api/Catalogue/GetDestinationCountries>>http://integration.kazunion.com/api/Catalogue/GetDestinationCountries]] | ||
22 | {{/info}} | ||
23 | |||
24 | |||
25 | == Request Parameters - API Endpoint: Destination Countries Retrieval == | ||
26 | |||
27 | (% class="box infomessage" %) | ||
28 | ((( | ||
29 | |||
30 | |||
31 | |**Key**|**Value**|**Request URL** | ||
32 | |onlyHotels|True|[[https:~~/~~/integration.kazunion.com/api/Catalogue/GetDestinationCountries?onlyHotels=true>>http://integration.kazunion.com/api/Catalogue/GetDestinationCountries?onlyHotels=true]] | ||
33 | |onlyHotels|False|[[https:~~/~~/integration.kazunion.com/api/Catalogue/GetDestinationCountries?onlyHotels=false>>http://integration.kazunion.com/api/Catalogue/GetDestinationCountries?onlyHotels=false]] | ||
34 | |||
35 | |||
36 | ))) | ||
37 | |||
38 | |||
39 | This section outlines the method to retrieve information about destination countries from our API, focusing on the availability of hotels and flight packages. The endpoint allows filtering based on the type of accommodations or packages you're interested in. | ||
40 | |||
41 | ==== Request Parameters ==== | ||
42 | |||
43 | * **onlyHotels**: A boolean parameter that determines the type of destinations to be retrieved. | ||
44 | ** **Value**: true or false | ||
45 | ** **Description**: When set to true, the API returns destinations that offer only hotel accommodations. Setting this to false retrieves destinations where both hotel accommodations and flight packages are available. | ||
46 | |||
47 | ==== Endpoint URLs ==== | ||
48 | |||
49 | * To retrieve **only hotel** destinations: | ||
50 | ** **Request URL**: https:~/~/integration.kazunion.com/api/Catalogue/GetDestinationCountries?onlyHotels=true | ||
51 | * To retrieve destinations with **both hotels and flights**: | ||
52 | ** **Request URL**: https:~/~/integration.kazunion.com/api/Catalogue/GetDestinationCountries?onlyHotels=false | ||
53 | |||
54 | ==== Use Case Explanation ==== | ||
55 | |||
56 | The system categorizes destination countries into two main types: | ||
57 | |||
58 | 1. **Destinations Offering Flight Packages**: These are destinations where tour packages that include both flights and hotel stays can be booked. | ||
59 | 1. **Hotel-Only Destinations**: These destinations are limited to hotel accommodations without the inclusion of flight packages. | ||
60 | |||
61 | By leveraging the onlyHotels parameter with appropriate boolean values (true or false), users can specify the type of destination they are interested in retrieving from the API. This feature allows for tailored queries, enabling a more focused and efficient retrieval of destination information suitable for various travel planning and booking applications. | ||
62 | |||
63 | |||
64 | == Request Body == | ||
65 | |||
66 | {{code language="Json"}} | ||
67 | none | ||
68 | {{/code}} | ||
69 | |||
70 | |||
71 | == Response Body == | ||
72 | |||
73 | {{code language="json"}} | ||
74 | { | ||
75 | "error": true, | ||
76 | "errorCode": "string", | ||
77 | "errorDescription": "string", | ||
78 | "userErrorDescription": "string", | ||
79 | "countries": [ | ||
80 | { | ||
81 | "countryCode": "string", | ||
82 | "countryName": "string", | ||
83 | "note": "string", | ||
84 | "phoneCode": "string", | ||
85 | "isO2": "string", | ||
86 | "isO3": "string", | ||
87 | "status": 0, | ||
88 | "sortingOrder": 0, | ||
89 | "sellCurrency": "string" | ||
90 | } | ||
91 | ] | ||
92 | } | ||
93 | {{/code}} | ||
94 | |||
95 | |||
96 | === example === | ||
97 | |||
98 | {{code language="Json"}} | ||
99 | { | ||
100 | "countryCode": "MV", | ||
101 | "countryName": "Maldives", | ||
102 | "phoneCode": "960", | ||
103 | "isO2": "MV", | ||
104 | "isO3": "MDV", | ||
105 | "status": 1, | ||
106 | "sortingOrder": 800, | ||
107 | "sellCurrency": "USD" | ||
108 | }, | ||
109 | { | ||
110 | "countryCode": "GE", | ||
111 | "countryName": "Georgia", | ||
112 | "phoneCode": "995", | ||
113 | "isO2": "GE", | ||
114 | "isO3": "GEO", | ||
115 | "status": 1, | ||
116 | "sortingOrder": 900, | ||
117 | "sellCurrency": "USD" | ||
118 | } | ||
119 | {{/code}} | ||
120 | |||
121 | |||
122 | === Schema === | ||
123 | |||
124 | (% data-xwiki-non-generated-content="java.util.List" %) | ||
125 | ((( | ||
126 | {{success}} | ||
127 | GetCountriesResponse{ | ||
128 | |||
129 | |error|boolean | ||
130 | |errorCode|string | ||
131 | nullable: true | ||
132 | |errorDescription|string | ||
133 | nullable: true | ||
134 | |userErrorDescription|string | ||
135 | nullable: true | ||
136 | |countries|[ | ||
137 | nullable: trueCountry{((( | ||
138 | |countryCode|string | ||
139 | nullable: true | ||
140 | readOnly: true | ||
141 | |countryName|string | ||
142 | nullable: true | ||
143 | |note|string | ||
144 | nullable: true | ||
145 | |phoneCode|string | ||
146 | nullable: true | ||
147 | |isO2|string | ||
148 | nullable: true | ||
149 | |isO3|string | ||
150 | nullable: true | ||
151 | |status|integer($int32) | ||
152 | |sortingOrder|integer($int32) | ||
153 | |sellCurrency|string | ||
154 | nullable: true | ||
155 | |||
156 | }] | ||
157 | ))) | ||
158 | |||
159 | } | ||
160 | {{/success}} | ||
161 | |||
162 | |||
163 | ))) | ||
164 | |||
165 | == Definitions == | ||
166 | |||
167 | |||
168 | (% class="table-bordered" %) | ||
169 | |=Field Name|=Data Type|=Description | ||
170 | |countries|Array |An array of objects, each representing a country. | ||
171 | |countryCode|string|The ISO 3166-1 alpha-2 country code. For example, "AZ" for Azerbaijan. | ||
172 | |countryName|string|The name of the country. | ||
173 | |phoneCode|string|The international dialing code for the country. For example, "994" for Azerbaijan. | ||
174 | |isO2|string|The ISO 3166-1 alpha-2 code for the country. This is typically the same as countryCode. | ||
175 | |isO3|string|The ISO 3166-1 alpha-3 code for the country. For example, "AZE" for Azerbaijan. | ||
176 | |status|integer|The status of the country. This could represent whether the country is active or not. For example, 1 could represent an active status. | ||
177 | |sortingOrder|integer|The sorting order for the country. This could be used to sort countries in a list. For example, 700. | ||
178 | |sellCurrency|string|The currency in which transactions are conducted in the country. This is typically in ISO 4217 format. For example, "USD" for United States Dollar | ||
179 | |||
180 | == Important == | ||
181 | |||
182 | {{error}} | ||
183 | === Implementing Authorization in Subsequent Requests === | ||
184 | |||
185 | For every API request after the initial authentication, it's crucial to include the authorization token in the request header. This ensures your requests are authorized and can access the necessary resources. Here's how to properly include your token: | ||
186 | |||
187 | * **Header Key:** Authorization | ||
188 | * **Header Value:** Bearer [Your Token Here] - Use the bearer token provided in the initial authentication response. The authorization type should be specified as Bearer Token. | ||
189 | |||
190 | Additionally, to ensure your requests are properly formatted and recognized, include the following headers: | ||
191 | |||
192 | * **Content-Type:** Specify this header as application/json to indicate the format of the request body. | ||
193 | * **Header Key:** X-nugios-timezone | ||
194 | * **Header Value:** 240 - Adjust this value to match your local timezone offset in minutes. | ||
195 | |||
196 | Incorporating these headers with their respective values is essential for the successful processing of your API requests. | ||
197 | {{/error}} |