I am a beginner to Shopware. I need to fetch data from an external API and display it in Shopware storefront. So far I have created a REST API inside the folder Core/Api/ where I have written all the http-client codes to fetch data.
My route is something like this:
@Route("/api/v{version}/_action/rest-api-handling/test", name="api.custom.rest_api_handling.test", methods={"GET"})
From the documentation https://docs.shopware.com/en/shopware-platform-dev-en/how-to/register-subscriber , I need to create a subscriber to dislay data.
class FooterSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
StorefrontRenderEvent::class => 'onFooterPageLoaded'
];
}
public function onFooterPageLoaded(StorefrontRenderEvent $event): array
{
return [
"array"
];
}
}
But I am not sure how can I call my Route.
Can anybody please help me.
Thank You.