What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hi all πŸ™‚ Which entry point is responsible for the Zed Api? backend-gateway, ba

UKHESMRD2
UKHESMRD2 Posts: 37 πŸ§‘πŸ»β€πŸš€ - Cadet

Hi all πŸ™‚ Which entry point is responsible for the Zed Api? backend-gateway, backend-api or backoffice? I am currently getting no result via one of the entry points. Just a No route found for "GET /api/rest/order-reference" error message. The documentation and the b2c shops are not really helpful -> https://docs.spryker.com/docs/scos/dev/sdk/zed-api/zed-api-project-implementation.html.

Comments

  • UK7KBE2JW
    UK7KBE2JW Posts: 463 πŸ§‘πŸ»β€πŸš€ - Cadet

    What you mean with Zed API? This one? https://github.com/spryker/api

  • UKHESMRD2
    UKHESMRD2 Posts: 37 πŸ§‘πŸ»β€πŸš€ - Cadet

    Yes

  • UK7KBE2JW
    UK7KBE2JW Posts: 463 πŸ§‘πŸ»β€πŸš€ - Cadet

    yeah this handles /api/rest/.... But /api/rest/order-reference is custom, right?

  • UKHESMRD2
    UKHESMRD2 Posts: 37 πŸ§‘πŸ»β€πŸš€ - Cadet

    yes, you are right. It's a custom endpoint for the api

  • UK7KBE2JW
    UK7KBE2JW Posts: 463 πŸ§‘πŸ»β€πŸš€ - Cadet

    And whats the problem/question?

  • UKHESMRD2
    UKHESMRD2 Posts: 37 πŸ§‘πŸ»β€πŸš€ - Cadet

    We are in the process of setting up the Glue Api and installing the first endpoints. Before we started with that, we only had one entry point for the backend. Just like in the old DemoShop (https://github.com/spryker/demoshop/tree/master/public/Zed). Due to the Glue Api we had to set up the other endpoints (backend-api, backend-gateway and backoffice). In addition to this we use the Zed Api. Unfortunately, after switching to the separate endpoints, the requests to the Zed Api no longer go through successfully. I only get a: "No route found for "GET /api/rest/order-reference" error message. I have integrated everything as described in the documentation. Unfortunately without success.

  • UKHESMRD2
    UKHESMRD2 Posts: 37 πŸ§‘πŸ»β€πŸš€ - Cadet

    An example of an ApplicationDependencyProvider.php including a configured Zed Api would be helpful. Maybe is miss something but everything is set up as described in the documentation

  • UK7KBE2JW
    UK7KBE2JW Posts: 463 πŸ§‘πŸ»β€πŸš€ - Cadet

    We use glue and we use the zed api in our project too. But we are not using backoffice at the moment. Did you register everything properly and clear cache and run router:cache:warm-up?

  • UK7KBE2JW
    UK7KBE2JW Posts: 463 πŸ§‘πŸ»β€πŸš€ - Cadet
    <?php
    
    namespace Pyz\Zed\Application;
    
    use Spryker\Zed\Application\ApplicationDependencyProvider as SprykerApplicationDependencyProvider;
    use Spryker\Zed\ErrorHandler\Communication\Plugin\Application\ErrorHandlerApplicationPlugin;
    use Spryker\Zed\EventDispatcher\Communication\Plugin\Application\EventDispatcherApplicationPlugin;
    use Spryker\Zed\Form\Communication\Plugin\Application\FormApplicationPlugin;
    use Spryker\Zed\GuiTable\Communication\Plugin\Application\GuiTableApplicationPlugin;
    use Spryker\Zed\Http\Communication\Plugin\Application\HttpApplicationPlugin;
    use Spryker\Zed\Locale\Communication\Plugin\Application\LocaleApplicationPlugin;
    use Spryker\Zed\Messenger\Communication\Plugin\Application\MessengerApplicationPlugin;
    use Spryker\Zed\Propel\Communication\Plugin\Application\PropelApplicationPlugin;
    use Spryker\Zed\Router\Communication\Plugin\Application\RouterApplicationPlugin;
    use Spryker\Zed\Session\Communication\Plugin\Application\SessionApplicationPlugin;
    use Spryker\Zed\Translator\Communication\Plugin\Application\TranslatorApplicationPlugin;
    use Spryker\Zed\Twig\Communication\Plugin\Application\TwigApplicationPlugin;
    use Spryker\Zed\Validator\Communication\Plugin\Application\ValidatorApplicationPlugin;
    use Spryker\Zed\WebProfiler\Communication\Plugin\Application\WebProfilerApplicationPlugin;
    
    class ApplicationDependencyProvider extends SprykerApplicationDependencyProvider
    {
        /**
         * @return \Spryker\Shared\ApplicationExtension\Dependency\Plugin\ApplicationPluginInterface[]
         */
        protected function getApplicationPlugins(): array
        {
            $applicationPlugins = [
                new SessionApplicationPlugin(),
                new TwigApplicationPlugin(),
                new EventDispatcherApplicationPlugin(),
                new LocaleApplicationPlugin(),
                new TranslatorApplicationPlugin(),
                new MessengerApplicationPlugin(),
                new PropelApplicationPlugin(),
                new RouterApplicationPlugin(),
                new HttpApplicationPlugin(),
                new ErrorHandlerApplicationPlugin(),
                new FormApplicationPlugin(),
                new ValidatorApplicationPlugin(),
                new GuiTableApplicationPlugin(),
            ];
    
            if (class_exists(WebProfilerApplicationPlugin::class)) {
                $applicationPlugins[] = new WebProfilerApplicationPlugin();
            }
    
            return $applicationPlugins;
        }
    }
    
  • UK7KBE2JW
    UK7KBE2JW Posts: 463 πŸ§‘πŸ»β€πŸš€ - Cadet
    <?php
    
    namespace Pyz\Zed\Application;
    
    use FondOfSpryker\Zed\ApiAuth\Communication\Plugin\Bootstrap\ApiAuthBootstrapProvider;
    use FondOfSpryker\Zed\Contentful\Communication\Plugin\ContentfulTwigServiceProvider;
    use Silex\Provider\ServiceControllerServiceProvider;
    use Spryker\Shared\ErrorHandler\Plugin\ServiceProvider\WhoopsErrorHandlerServiceProvider;
    use Spryker\Zed\Api\Communication\Plugin\ApiServiceProviderPlugin;
    use Spryker\Zed\Api\Communication\Plugin\ServiceProvider\ApiRoutingServiceProvider;
    use Spryker\Zed\Application\ApplicationDependencyProvider as SprykerApplicationDependencyProvider;
    use Spryker\Zed\Application\Communication\Plugin\ServiceProvider\RequestServiceProvider;
    use Spryker\Zed\Application\Communication\Plugin\ServiceProvider\RoutingServiceProvider;
    use Spryker\Zed\Application\Communication\Plugin\ServiceProvider\SslServiceProvider;
    use Spryker\Zed\ErrorHandler\Communication\Plugin\Application\ErrorHandlerApplicationPlugin;
    use Spryker\Zed\EventBehavior\Communication\Plugin\ServiceProvider\EventBehaviorServiceProvider;
    use Spryker\Zed\EventDispatcher\Communication\Plugin\Application\EventDispatcherApplicationPlugin;
    use Spryker\Zed\Form\Communication\Plugin\Application\FormApplicationPlugin;
    use Spryker\Zed\Http\Communication\Plugin\Application\HttpApplicationPlugin;
    use Spryker\Zed\Kernel\Container;
    use Spryker\Zed\Locale\Communication\Plugin\Application\LocaleApplicationPlugin;
    use Spryker\Zed\Messenger\Communication\Plugin\Application\MessengerApplicationPlugin;
    use Spryker\Zed\Propel\Communication\Plugin\Application\PropelApplicationPlugin;
    use Spryker\Zed\Propel\Communication\Plugin\ServiceProvider\PropelServiceProvider;
    use Spryker\Zed\Router\Communication\Plugin\Application\RouterApplicationPlugin;
    use Spryker\Zed\Session\Communication\Plugin\Application\SessionApplicationPlugin;
    use Spryker\Zed\Translator\Communication\Plugin\Application\TranslatorApplicationPlugin;
    use Spryker\Zed\Twig\Communication\Plugin\Application\TwigApplicationPlugin;
    use Spryker\Zed\Validator\Communication\Plugin\Application\ValidatorApplicationPlugin;
    use Spryker\Zed\WebProfiler\Communication\Plugin\Application\WebProfilerApplicationPlugin;
    
    class ApplicationDependencyProvider extends SprykerApplicationDependencyProvider
    {
        protected const DEVELOPMENT_ENVIRONMENT = 'development';
    
        /**
         * @return \Spryker\Shared\ApplicationExtension\Dependency\Plugin\ApplicationPluginInterface[]
         */
        protected function getApplicationPlugins(): array
        {
            $dev = [];
            if (APPLICATION_ENV === 'development' && class_exists('WebProfilerApplicationPlugin')) {
                $dev = [
                    new WebProfilerApplicationPlugin(),
                ];
            }
    
            return array_merge(
                [
                    new TwigApplicationPlugin(),
                    new EventDispatcherApplicationPlugin(),
                    new LocaleApplicationPlugin(),
                    new TranslatorApplicationPlugin(),
                    new MessengerApplicationPlugin(),
                    new PropelApplicationPlugin(),
                    new RouterApplicationPlugin(),
                    new HttpApplicationPlugin(),
                    new SessionApplicationPlugin(),
                    new ErrorHandlerApplicationPlugin(),
                    new FormApplicationPlugin(),
                    new ValidatorApplicationPlugin(),
                ],
                $dev
            );
        }
    
        /**
         * @param \Spryker\Zed\Kernel\Container $container
         *
         * @return \Silex\ServiceProviderInterface[]
         */
        protected function getServiceProviders(Container $container): array
        {
            $serviceProviders = parent::getServiceProviders($container);
    
            $serviceProviders[] = new ContentfulTwigServiceProvider();
    
            return $serviceProviders;
        }
    
        /**
         * The ZED Api layer was discontinued but will remain maintained
         * Usage will continue until full replacement
         *
         * @param \Spryker\Zed\Kernel\Container $container
         *
         * @return \Silex\ServiceProviderInterface[]
         */
        protected function getApiServiceProviders(Container $container)
        {
            $providers = [
                new RequestServiceProvider(),
                new SslServiceProvider(),
                new ServiceControllerServiceProvider(),
                new RoutingServiceProvider(),
                new ApiServiceProviderPlugin(),
                new ApiRoutingServiceProvider(),
                new PropelServiceProvider(),
                new EventBehaviorServiceProvider(),
                new ApiAuthBootstrapProvider(),
            ];
    
            if (APPLICATION_ENV === static::DEVELOPMENT_ENVIRONMENT) {
                $providers[] = new WhoopsErrorHandlerServiceProvider();
            }
    
            return $providers;
        }
    }
    
  • UK7KBE2JW
    UK7KBE2JW Posts: 463 πŸ§‘πŸ»β€πŸš€ - Cadet

    Dunno if this will help you

  • UKHESMRD2
    UKHESMRD2 Posts: 37 πŸ§‘πŸ»β€πŸš€ - Cadet

    Thank you for the examples πŸ™‚