I want to extract some country's holiday list from Google Calendar API using JavaScript.
Is it Possible? How Can I do this?
I want to extract some country's holiday list from Google Calendar API using JavaScript.
Is it Possible? How Can I do this?
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
https://www.googleapis.com/calendar/v3/calendars/en.uk%23holiday%40group.v.calendar.google.com/events?key=<YOUR API KEY>
us
, uk
, singapore
, china
, indian
, philippines
, spain
... but there are still a lot of countries which I want to use but don't know the value to supply in the API call. This is why I wanted to get the list of countries (code) that I could use in calling this API. Thanks –
Hierarchize past one year
, current year
and future year
for the specified country. Is there a way to get a particular year in past or in future? –
Sapphera google provides API for holiday list.
then, change this text in url
calendars/en.usa
after this,
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",
https://gist.github.com/dhoeric/76bd1c15168ee0ee61ad3bf1730dcb65
Here is the list of all countries.
need to replace en.indian.official#[email protected]
in url.
highlighted part need to replace. If you get authentication error then replace
#
with %23
and
@
with %40
Due some parsing issue it gives authentication issue.
© 2022 - 2024 — McMap. All rights reserved.