Skip to content

Store API

Store API ​

Use the Store API to add custom endpoints or extend existing ones in plugins. Store API routes are service-based and follow strict architectural conventions to ensure consistency, cacheability, and extensibility.

Core principles ​

Routes:

  • Do not implement the Sales Channel API, deprecated as of 6.4.
  • Define Store API controllers as services.
  • Use named routes internally.
  • Each route class or API method requires the attribute: #[Route(defaults: [\Shopware\Core\PlatformRequest::ATTRIBUTE_ROUTE_SCOPE => [\Shopware\Core\Framework\Routing\StoreApiRouteScope::ID]])].
  • Response decorators must extend StoreApiResponse.

Route design:

  • A route represents a single, focused functionality.
  • A route must return a StoreApiResponse, to convert to JSON.
  • A route response can only contain one object.
  • A route exposes an extension event through ExtensionDispatcher, which should be used to extend the route behavior.
  • Older routes may still extend abstract route contracts, which could be deprecated in the future. They can still be used for backward compatibility, but it is encouraged to use the extension event instead.

Storefront integration:

  • Storefront controllers must not access repositories directly.
  • Controllers must call Store API routes.
  • Page loaders and controllers may call multiple routes.
  • Business logic belongs in Store API routes, not in controllers.

Next steps ​

Review our guides for adding routes and overriding existing routes.

Was this page helpful?
UnsatisfiedSatisfied
Be the first to vote!
0.0 / 5  (0 votes)