Welcome to the Get Holidays List from Google Calendar API template! This template is designed to help you build an application that fetches holiday information for a specific country and year using the Google Calendar API. It's a great tool for developers who want to integrate holiday data into their applications without having to worry about the complexities of API integration and server setup.
To begin using this template, simply click on the "Start with this Template" button. This will pre-populate the code in the Lazy Builder interface, so you won't need to copy, paste, or delete any code manually.
Before you can use this template, you'll need to set up an environment secret for the Google Calendar API key. Here's how to do it:
Once you have set up your environment secret, you can test the application by clicking the "Test" button. This will deploy your app and launch the Lazy CLI.
After pressing the "Test" button, Lazy will provide you with a dedicated server link to use the API. Additionally, since this template uses FastAPI, you will also be provided with a link to the API documentation.
To fetch holidays for a specific country and year, you will use the provided server link followed by the endpoint pattern `/holidays/{country_code}/{year}`. Replace `{country_code}` with the desired country code and `{year}` with the year you want to fetch holidays for.
Here's an example of how to make a request:
GET http://your-server-link/holidays/en.usa/2023
You should expect a response similar to this:
[
{
"kind": "calendar#event",
"etag": "\"etag\"",
"id": "event_id",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=event_id",
"created": "datetime",
"updated": "datetime",
"summary": "New Year's Day",
"description": "New Year's Day is a public holiday in the USA.",
...
},
...
]
If you want to integrate this holiday information into another service or frontend, you can use the server link provided by Lazy to make API requests from your application. Ensure that you handle the API responses correctly and display the holiday data as needed in your application.
For example, if you're building a calendar application, you can use the fetched holiday data to mark holidays on the calendar for users based on their country and year selection.
Remember to respect the Google Calendar API usage limits and terms of service when integrating and using the API in your application.
By following these steps, you should now have a functional application that can fetch and display holiday information from the Google Calendar API. Happy building!