Accessing API in custom component from import of component

There is an API to fetch calendar events using a bearer token at

http://homeassistant:8123/api/calendars/calendar.name?start=2019-12-09T00:00:00Z&end=2019-12-10T00:00:00Z

If I wanna do this internally in the custom component I’m building I have got the information that I should import the calendar component. Im struggling how to utilize this component to fetch the same data as I did with the HTTP API.

There is also the Google Calendar component, is it that one I should use instead since Im only doing google calendar data?

How would I fetch the same data as doing with the API but with the imported component?

Thank you

If you’re in a custom_component, and you already have the google calendar component loaded, can’t you just get the information you need from the calendar entity state and attributes?

1 Like

The calendar entity and attributes just show the next upcoming event, I wanna be able to fetch for specific dates etc.

I had no idea Home Assistant kept all of that data and made it available via API.

Hopefully, you’ll find what you’re looking for in the component.

1 Like

Yeah, but I can’t find documentation on how to use it without calling the HTTP address in a custom component. Thank you anyway @swiftlyfalling