Get US State Holidays

PAID
By Christian Coello | Updated एक महीने पहले | Data
Popularity

6.1 / 10

Latency

1,653ms

Service Level

75%

Health Check

N/A

README

Here’s a documentation template for your RESTful POST API that retrieves all designated holidays for any specified US state using the 2-letter state code and year. This template can be modified as needed to fit into your overall API documentation style and structure.


Get State Holidays API

The Get State Holidays API allows clients to retrieve a list of all designated holidays for a specified US state and year. This service is ideal for applications needing to display or use holiday data based on state-specific observances.

Endpoint

POST /get-state-holidays

Request

This API expects a JSON payload in the POST request body with the following parameters:

  • state (string): The 2-letter code of the US state for which holidays are being requested.
  • year (string): The year for which the holidays are being requested.

Headers

Request Body Example

{
  "state": "TX",
  "year": "2023"
}

Response

The response is a JSON object where each key is a date in the format “YYYY-MM-DD”, and the corresponding value is the name of the holiday on that date.

Response Body Example

{
  "2023-01-01": "New Year's Day",
  "2023-01-02": "New Year's Day (observed)",
  "2023-01-16": "Martin Luther King Jr. Day",
  "2023-01-19": "Confederate Memorial Day",
  ...
  "2023-12-25": "Christmas Day",
  "2023-12-26": "Day After Christmas"
}

Status Codes

The API uses the following status codes:

  • 200 OK: The request was successful, and the holidays have been returned.
  • 400 Bad Request: The request was invalid. This can occur if the request body does not contain valid JSON or missing required parameters.
  • 404 Not Found: No holidays found for the specified state and year.
  • 500 Internal Server Error: An error occurred on the server while processing the request.

Error Handling

In case of an error, the API returns a JSON response with the following structure:

{
  "error": "Error description"
}

This error message provides a brief description of what went wrong, aiding in debugging.

Two Letter State Codes

Here’s a list of all the two-letter state codes for the United States in Markdown format:

- AL - Alabama
- AK - Alaska
- AZ - Arizona
- AR - Arkansas
- CA - California
- CO - Colorado
- CT - Connecticut
- DE - Delaware
- FL - Florida
- GA - Georgia
- HI - Hawaii
- ID - Idaho
- IL - Illinois
- IN - Indiana
- IA - Iowa
- KS - Kansas
- KY - Kentucky
- LA - Louisiana
- ME - Maine
- MD - Maryland
- MA - Massachusetts
- MI - Michigan
- MN - Minnesota
- MS - Mississippi
- MO - Missouri
- MT - Montana
- NE - Nebraska
- NV - Nevada
- NH - New Hampshire
- NJ - New Jersey
- NM - New Mexico
- NY - New York
- NC - North Carolina
- ND - North Dakota
- OH - Ohio
- OK - Oklahoma
- OR - Oregon
- PA - Pennsylvania
- RI - Rhode Island
- SC - South Carolina
- SD - South Dakota
- TN - Tennessee
- TX - Texas
- UT - Utah
- VT - Vermont
- VA - Virginia
- WA - Washington
- WV - West Virginia
- WI - Wisconsin
- WY - Wyoming

These codes are widely used in various contexts, from postal addresses to data entry, and are recognized by the United States Postal Service (USPS).


This template provides a clear and concise description of how to use the API, including request and response formats, which should help developers integrate this service into their applications efficiently.

Followers: 0
API Creator:
Rapid account: Christian Coello
Christian Coello
christiancoello2389
Log In to Rate API
Rating: 5 - Votes: 1