Get Country Holidays

PAID
By Christian Coello | Updated месяц назад | Data
Health Check

N/A

README

Get Country Holidays API

This API endpoint retrieves all designated public holidays for a specified country and year. It requires a JSON payload with the country’s 2-letter ISO code and the year as input parameters.

HTTP Request

POST /get-country-holidays

Request Headers

Request Body

The request body must be a JSON object containing the following fields:

  • country_code (string): The 2-letter ISO 3166-1 alpha-2 country code of the country for which you want to retrieve holidays.
  • year (string): The year for which the holidays are requested.

Example Request Body

{
  "country_code": "US",
  "year": "2023"
}

Successful Response

A successful response will be returned with HTTP status code 200 OK and will contain a list of holidays in JSON format. Each holiday object includes the name of the holiday, its date, and a brief description.

Response Properties

  • date (string): The date of the holiday in YYYY-MM-DD format.
  • name (string): The name of the holiday.

Example Response

{"2024-01-01": "New Year's Day", "2024-01-15": "Martin Luther King Jr. Day", "2024-02-19": "Washington's Birthday", "2024-05-27": "Memorial Day", "2024-06-19": "Juneteenth National Independence Day", "2024-07-04": "Independence Day", "2024-09-02": "Labor Day", "2024-10-14": "Columbus Day", "2024-11-11": "Veterans Day", "2024-11-28": "Thanksgiving", "2024-12-25": "Christmas Day"}

Error Responses

The API may return the following error responses in cases where the request cannot be successfully processed:

  • 400 Bad Request: This response is returned if the request body does not contain both the country_code and year fields or if they are in an incorrect format.
{
  "error": "Invalid request format. Please ensure your JSON includes 'country_code' and 'year' as strings."
}
  • 404 Not Found: This response is returned if no holidays are found for the given country code and year, or if the country code is not recognized.
{
  "error": "No holidays found for the specified country code and year, or country code not recognized."
}
  • 500 Internal Server Error: This generic error response is returned in case of an unexpected server error.
{
  "error": "An unexpected error occurred. Please try again later."
}

Country Codes

The following country codes can be used in the country_code attribute of the request body.

  • AF - Afghanistan
  • AX - Åland Islands
  • AL - Albania
  • DZ - Algeria
  • AS - American Samoa
  • AD - Andorra
  • AO - Angola
  • AI - Anguilla
  • AQ - Antarctica
  • AG - Antigua and Barbuda
  • AR - Argentina
  • AM - Armenia
  • AW - Aruba
  • AU - Australia
  • AT - Austria
  • AZ - Azerbaijan
  • BS - Bahamas
  • BH - Bahrain
  • BD - Bangladesh
  • BB - Barbados
  • BY - Belarus
  • BE - Belgium
  • BZ - Belize
  • BJ - Benin
  • BM - Bermuda
  • BT - Bhutan
  • BO - Bolivia (Plurinational State of)
  • BQ - Bonaire, Sint Eustatius and Saba
  • BA - Bosnia and Herzegovina
  • BW - Botswana
  • BV - Bouvet Island
  • BR - Brazil
  • IO - British Indian Ocean Territory
  • BN - Brunei Darussalam
  • BG - Bulgaria
  • BF - Burkina Faso
  • BI - Burundi
  • CV - Cabo Verde
  • KH - Cambodia
  • CM - Cameroon
  • CA - Canada
  • KY - Cayman Islands
  • CF - Central African Republic
  • TD - Chad
  • CL - Chile
  • CN - China
  • CX - Christmas Island
  • CC - Cocos (Keeling) Islands
  • CO - Colombia
  • KM - Comoros
  • CG - Congo
  • CD - Congo (Democratic Republic of the)
  • CK - Cook Islands
  • CR - Costa Rica
  • CI - Côte d’Ivoire
  • HR - Croatia
  • CU - Cuba
  • CW - Curaçao
  • CY - Cyprus
  • CZ - Czech Republic
  • DK - Denmark
  • DJ - Djibouti
  • DM - Dominica
  • DO - Dominican Republic
  • EC - Ecuador
  • EG - Egypt
  • SV - El Salvador
  • GQ - Equ
Followers: 0
API Creator:
Rapid account: Christian Coello
Christian Coello
christiancoello2389
Log In to Rate API
Rating: 5 - Votes: 1