The Official Holiday and Event API for Go
Industry-leading Holiday and Event API for Go. Over 5,000 holidays and thousands of descriptions. Trusted by the World’s leading companies. Built by developers for developers since 2011.
Supported Go Versions
Latest version of the the Holiday and Event API supports last two Go major releases and might work with older versions.
Authentication
Access to the Holiday and Event API requires an API Key. You can get for one for FREE here, no credit card required! Note that free plans are limited. To access more data and have more requests, a paid plan is required.
Installation
go get github.com/westy92/holiday-event-api-go
Example
import (
"fmt"
holidays "github.com/westy92/holiday-event-api-go"
)
func main() {
client, err := holidays.New("<your API key>")
if err != nil {
fmt.Println(err)
return
}
events, err := client.GetEvents(holidays.GetEventsRequest{
})
if err != nil {
fmt.Println(err)
return
}
event := events.Events[0]
fmt.Printf("Today is %s! Find more information at: %s.\n", event.Name, event.Url)
fmt.Printf("Rate limit remaining: %d/%d (month).\n", events.RateLimit.RemainingMonth, events.RateLimit.LimitMonth)
eventInfo, err := client.GetEventInfo(holidays.GetEventInfoRequest{
Id: event.Id,
})
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("The Event's hashtags are %q.\n", eventInfo.Event.Hashtags)
query := "pizza day"
search, err := client.Search(holidays.SearchRequest{
Query: query,
})
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("Found %d events, including %s, that match the query \"%s\".\n", len(search.Events), search.Events[0].Name, query)
}