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 Guys, I am trying to add a new Ressource for the Zed api but it seems like the route is not corre

U01A1HDSVS8
U01A1HDSVS8 Posts: 17 🧑🏻‍🚀 - Cadet

Hi Guys,
I am trying to add a new Ressource for the Zed api but it seems like the route is not correctly resolved. When I access /api/rest/my-ressource it tries to access the myRessourceAction of the RestController instead of the index action. What am I missing?

Comments

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice
    edited September 2020

    @UKJSE6T47 can you suggest anything as you worked with and extended Zed API?

  • Andriy Netseplyayev
    Andriy Netseplyayev Domain Lead Solution Architecture Sprykee Posts: 519 🧑🏻‍🚀 - Cadet

    Sure!
    Hey Dirk, when did you update Spryker last time, or when did you start the project?

  • U01A1HDSVS8
    U01A1HDSVS8 Posts: 17 🧑🏻‍🚀 - Cadet

    Hi Andriy,
    I'm quite new to the project. I think single packages were updated as new features were needed. A general update was not done for quite some time (~2 years), but it is currently work in progress! spryker/kernel is quite current (3.55.0).
    I managed to get the route resolving to work by adding the ApiRoutingServiceProvider before other RoutingServiceProvider in the ApplicationDependencyProvider.
    What still confuses me is that I have to add the route to the $config[AclConstants::ACL_DEFAULT_RULES] and the AuthConfig otherwise it will redirect me to the backend login page. Is this the correct behavior? As the documentation states that no authorization is yet implemented.
    Thank you for your help!

  • Andriy Netseplyayev
    Andriy Netseplyayev Domain Lead Solution Architecture Sprykee Posts: 519 🧑🏻‍🚀 - Cadet

    Hey Dirk,
    Glad to hear you’ve solved the issue with routing. Please make sure that all the endpoints (customers, products) that we have ootb are available.

    The Zed API itself doesn’t have it’s own authorization yet, this is true. Since Zed API is also part of the Zed’s infrastructure, you experience a “backend login page redirect” behaviour.

  • Andriy Netseplyayev
    Andriy Netseplyayev Domain Lead Solution Architecture Sprykee Posts: 519 🧑🏻‍🚀 - Cadet

    If you want to introduce the authorization to the Zed API, I can give you couple of hints/advises, based on my own experience - just let me know

  • U01A1HDSVS8
    U01A1HDSVS8 Posts: 17 🧑🏻‍🚀 - Cadet

    As we will probably need some form of authorization in the future, I am very interested in your experience! I was thinking about adding a new user to the

    $config[AclConstants::ACL_DEFAULT_CREDENTIALS]
    

    array.

  • Andriy Netseplyayev
    Andriy Netseplyayev Domain Lead Solution Architecture Sprykee Posts: 519 🧑🏻‍🚀 - Cadet
    edited September 2020

    @U01A1HDSVS8 I’ll prepare an overview for you and send it to PM, a bit later (most likely tomorrow) 👍

  • U01A1HDSVS8
    U01A1HDSVS8 Posts: 17 🧑🏻‍🚀 - Cadet

    Thank you very much!