Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Holidays List of a Country from Google Calendar API

I want to extract some country's holiday list from Google Calendar API using JavaScript.

Is it Possible? How Can I do this?

like image 474
Mohammed Safeer Avatar asked Jun 14 '15 19:06

Mohammed Safeer


People also ask

How do I get holidays on my Google Calendar API?

To use Google Calendar API, you need to have API key from Google. Go to Google Developer Console and from the credential section, create a API for yourself. Each request to calendar API would need that key to process successfully.

Is Holiday API free?

Festivo Holiday API is a global bank holiday & observance JSON API platform. With support for 8000+ holidays in native languages in 250+ countries, we got you covered. Get started for FREE!


2 Answers

Yes, using Google API you can do that.

  • Create an API app in the google developer account

  • From the "Credentials" tab you can create an API key, you get something like this AIzaSyBcOT_DpEQysiwFmmmZXupKpnrOdJYAhhM

  • Then, you can access holidays calendar using this URL

like image 93
Flames Avatar answered Oct 25 '22 01:10

Flames


google provides API for holiday list.

https://www.googleapis.com/calendar/v3/calendars/en.uk%23holiday%40group.v.calendar.google.com/events?key=YourApiKey

  1. like we want holiday list for USA

then, change this text in url

calendars/en.usa

Example :- https://www.googleapis.com/calendar/v3/calendars/en.usa%23holiday%40group.v.calendar.google.com/events?key=YourApiKey

after this,

  1. we get all Holiday event list in "items" Array.

like this,

 "items": [
  {
   "kind": "calendar#event",
   "etag": "\"3101513576000000\"",
   "id": "20200101_60o30dr46oo30c1g60o30dr56g",
   "status": "confirmed",
   "htmlLink": "https://www.google.com/calendar/event?eid=MjAyMDAxMDFfNjBvMzBkcjQ2b28zMGMxZzYwbzMwZHI1NmcgZW4udXNhI2hvbGlkYXlAdg",
   "created": "2019-02-21T13:46:28.000Z",
   "updated": "2019-02-21T13:46:28.000Z",
   "summary": "New Year's Day",
   "creator": {
    "email": "en.usa#[email protected]",
    "displayName": "Holidays in United States",
    "self": true
   },
   "organizer": {
    "email": "en.usa#[email protected]",
    "displayName": "Holidays in United States",
    "self": true
   },
   "start": {
    "date": "2020-01-01"
   },
   "end": {
    "date": "2020-01-02"
   },
   "transparency": "transparent",
   "visibility": "public",
   "iCalUID": "[email protected]",
   "sequence": 0
  },
  {
.........

we will get all detail in there like, Holiday name of day in "summary" key

"summary": "New Year's Day",
like image 45
shirsh shukla Avatar answered Oct 25 '22 01:10

shirsh shukla