miguel.nz

Bullhorn Rest API: Full country list with Name, ID in PHP

March 9, 2018   |   3 minutes read.

One of the latest projects I’ve been working as a Freelance Web Developer consist in the integration between WordPress and the Bullhorn API. To be more specifically between Gravity Forms and the Bullhorn API. Gravity form is a great form plugin for WordPress with amazing documentation for you to customise and hook additional features. Bullhorn, on the other hand is a CRM that let you manage people’s data. Bullhorn also provides a REST API for you to work with.

A very specific requirement was to integrate the country field from Gravity Form with the candidate’s data. There’s not a lot of documentation regarding to the country list nor the full list.

So after contacting support they gave us a full list with all countries. Here is a little function that will help you in case:

– You’re working with Bullhorn
– You want to submit the country field
– You’re working with PHP


 "Afghanistan",
      2407 => "Åland Islands",
      2186 => "Albania",
      2187 => "Algeria",
      2408 => "American Samoa",
      2188 => "Andorra",
      2189 => "Angola",
      2409 => "Anguilla",
      2190 => "Antarctica",
      2191 => "Antigua and Barbuda",
      2192 => "Argentina",
      2193 => "Armenia",
      2373 => "Aruba",
      2194 => "Australia",
      2195 => "Austria",
      2196 => "Azerbaijan",
      2197 => "Bahamas",
      2198 => "Bahrain",
      2199 => "Bangladesh",
      2200 => "Barbados",
      2201 => "Belarus",
      2202 => "Belgium",
      2203 => "Belize",
      2204 => "Benin",
      2372 => "Bermuda",
      2205 => "Bhutan",
      2206 => "Bolivia; Plurinational State",
      2207 => "Bosnia and Herzegovina",
      2208 => "Botswana",
      2410 => "Bouvet Island",
      2209 => "Brazil",
      2411 => "British Indian Ocean Territory",
      2210 => "Brunei Darussalam",
      2211 => "Bulgaria",
      2212 => "Burkina Faso",
      2385 => "Burma",
      2213 => "Burundi",
      2214 => "Cambodia",
      2215 => "Cameroon",
      2216 => "Canada",
      2217 => "Cape Verde",
      2379 => "Cayman Islands",
      2218 => "Central African Republic",
      2219 => "Chad",
      2386 => "Channel Islands",
      2220 => "Chile",
      2221 => "China",
      2412 => "Christmas Island",
      2413 => "Cocos (Keeling) Islands",
      2222 => "Colombia",
      2223 => "Comoros",
      2368 => "Congo; Democratic Republic of",
      2383 => "Congo; Republic of",
      2414 => "Cook Islands",
      2226 => "Costa Rica",
      2227 => "Cote D'Ivoire",
      2228 => "Croatia",
      2229 => "Cuba",
      2387 => "Curacao",
      2230 => "Cyprus",
      2231 => "Czech Republic",
      2232 => "Denmark",
      2233 => "Djibouti",
      2234 => "Dominica",
      2235 => "Dominican Republic",
      2236 => "Ecuador",
      2237 => "Egypt",
      2238 => "El Salvador",
      2239 => "Equatorial Guinea",
      2240 => "Eritrea",
      2241 => "Estonia",
      2242 => "Ethiopia",
      2415 => "Falkland Islands (Malvinas)",
      2388 => "Faroe Islands",
      2243 => "Fiji",
      2244 => "Finland",
      2245 => "France",
      2416 => "French Guiana",
      2417 => "French Polynesia",
      2418 => "French Southern Territories",
      2246 => "Gabon",
      2389 => "Gambia",
      2248 => "Georgia",
      2249 => "Germany",
      2250 => "Ghana",
      2390 => "Gibraltar",
      2251 => "Greece",
      2252 => "Greenland",
      2253 => "Grenada",
      2419 => "Guadeloupe",
      2376 => "Guam",
      2371 => "Guatemala",
      2420 => "Guernsey",
      2255 => "Guinea",
      2256 => "Guinea-Bissau",
      2257 => "Guyana",
      2258 => "Haiti",
      2421 => "Heard and McDonald Islands",
      2362 => "Holy See (Vatican City State)",
      2259 => "Honduras",
      2377 => "Hong Kong",
      2260 => "Hungary",
      2261 => "Iceland",
      2262 => "India",
      2263 => "Indonesia",
      2264 => "Iran",
      2265 => "Iraq",
      2266 => "Ireland",
      2445 => "Isle of Man",
      2268 => "Italy",
      2269 => "Jamaica",
      2270 => "Japan",
      2422 => "Jersey",
      2271 => "Jordan",
      2272 => "Kazakhstan",
      2273 => "Kenya",
      2391 => "Kiribati",
      2274 => "North Korea",
      2275 => "South Korea",
      2392 => "Kosovo",
      2276 => "Kuwait",
      2277 => "Kyrgyzstan",
      2278 => "Lao People's Democratic Republic",
      2279 => "Latvia",
      2280 => "Lebanon",
      2281 => "Lesotho",
      2282 => "Liberia",
      2380 => "Libyan Arab Jamahiriya",
      2284 => "Liechtenstein",
      2285 => "Lithuania",
      2286 => "Luxembourg",
      2287 => "Macau",
      2288 => "Macedonia",
      2367 => "Macedonia; the Former Yugoslav Republic",
      2289 => "Madagascar",
      2290 => "Malawi",
      2291 => "Malaysia",
      2384 => "Maldives; Repulic of",
      2292 => "Mali",
      2293 => "Malta",
      2394 => "Marshall Islands",
      2423 => "Martinique",
      2294 => "Mauritania",
      2295 => "Mauritius",
      2393 => "Mayotte",
      2296 => "Mexico",
      2297 => "Micronesia; Federated States of",
      2395 => "Moldova",
      2299 => "Monaco",
      2300 => "Mongolia",
      2396 => "Montenegro",
      2424 => "Montserrat",
      2301 => "Morocco",
      2302 => "Mozambique",
      2303 => "Myanmar",
      2304 => "Namibia",
      2397 => "Nauru",
      2305 => "Nepal",
      2306 => "Netherlands",
      2425 => "Netherlands Antilles",
      2426 => "New Caledonia",
      2307 => "New Zealand",
      2308 => "Nicaragua",
      2309 => "Niger",
      2310 => "Nigeria",
      2427 => "Niue",
      2428 => "Norfolk Island",
      2429 => "Northern Mariana Islands",
      2311 => "Norway",
      2312 => "Oman",
      2313 => "Pakistan",
      2314 => "Palau",
      2430 => "Palestine",
      2315 => "Panama",
      2316 => "Papua New Guinea",
      2317 => "Paraguay",
      2318 => "Peru",
      2319 => "Philippines",
      2431 => "Pitcairn",
      2320 => "Poland",
      2321 => "Portugal",
      2374 => "Puerto Rico",
      2322 => "Qatar",
      2398 => "Reunion",
      2323 => "Romania",
      2324 => "Russian Federation",
      2325 => "Rwanda",
      2432 => "Saint Barthélemy",
      2433 => "Saint Helena; Ascension and Tristan Da Cunha",
      2399 => "Saint Kitts and Nevis",
      2326 => "Saint Lucia",
      2434 => "Saint Martin",
      2435 => "Saint Pierre And Miquelon",
      2400 => "Saint Vincent and Grenadines",
      2401 => "Samoa",
      2327 => "San Marino",
      2403 => "Sao Tome and Principe",
      2328 => "Saudi Arabia",
      2329 => "Senegal",
      2402 => "Serbia",
      2331 => "Seychelles",
      2332 => "Sierra Leone",
      2333 => "Singapore",
      2334 => "Slovakia",
      2335 => "Slovenia",
      2336 => "Solomon Islands",
      2337 => "Somalia",
      2338 => "South Africa",
      2436 => "South Georgia and the South Sandwich Islands",
      2339 => "Spain",
      2340 => "Sri Lanka",
      2341 => "Sudan",
      2342 => "Suriname",
      2437 => "Svalbard And Jan Mayen",
      2343 => "Swaziland",
      2344 => "Sweden",
      2345 => "Switzerland",
      2381 => "Syrian Arab Republic",
      2375 => "Taiwan",
      2348 => "Tajikistan",
      2349 => "Tanzania",
      2350 => "Thailand",
      2404 => "Timor-Leste",
      2351 => "Togo",
      2438 => "Tokelau",
      2405 => "Tonga",
      2352 => "Trinidad and Tobago",
      2353 => "Tunisia",
      2354 => "Turkey",
      2355 => "Turkmenistan",
      2439 => "Turks and Caicos Islands",
      2440 => "Tuvalu",
      2356 => "Uganda",
      2357 => "Ukraine",
      2358 => "United Arab Emirates",
      2359 => "United Kingdom",
      1 => "United States",
      2441 => "United States Minor Outlying Islands",
      2360 => "Uruguay",
      2361 => "Uzbekistan",
      2406 => "Vanuatu",
      2363 => "Venezuela; Bolivarian Republic of",
      2364 => "Vietnam",
      2446 => "Virgin Islands; British",
      2442 => "Virgin Islands; U.S.",
      2443 => "Wallis and Futuna",
      2444 => "Western Sahara",
      2382 => "Yemen",
      2369 => "Zambia",
      2370 => "Zimbabwe"
    );
    
    $key = array_search($country, $country_list);
    
    if ($key):
      return $key;
    endif;
    
    // 2378 => "None Specified"
    return 2378;
  
  }
}