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, I need to call 3rd part api from zed and I'm thinking which approach will be better: 1. call 3rd

USZB5JN4W
USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

Hi,
I need to call 3rd part api from zed and I'm thinking which approach will be better:
1. call 3rd part api directly from the Zed using for example Guzzle Http Client
2. implement communication with 3rd part api in Client module (also using for example Guzzle) and call Client from Zed
3. other?
Is Client designed for "internal" communication, around Spryker's ecosystem only, or can/should it communicate with 3rd part systems?

Comments

  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 πŸ§‘πŸ»β€πŸš€ - Cadet

    Hey Przemyslaw,
    Normally we go for option 1.
    However, you’re not forbidden to use Client for that too, especially in case when you need to re-use that functionality on Yves or Glue.
    Client was originally designed for Yves and Glue to β€œtalk to the external world” - Zed, Session, KeyValue, Search, …

  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 πŸ§‘πŸ»β€πŸš€ - Cadet

    Cases when Zed is using the Client are seldom and are rather exceptional.

  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 πŸ§‘πŸ»β€πŸš€ - Cadet

    on one of the projects we had a need to access ES on Zed, making sure the search results are exactly the same as in Yves, and so we re-used Client for that. Worked perfectly fine for us.

  • USZB5JN4W
    USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

    thanks! πŸ™‚ So it's not specified and we can use both options, but if this communication is zed only specific, then probably better is to not use client, am I right?

  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 πŸ§‘πŸ»β€πŸš€ - Cadet

    correct. If you see that this 3rd party will be called by Zed only, there is no need in additional layer/abstraction, like Client. You can have a module that would play somewhat an Adapter role, accepting transfer objects as requests and returning back transfer objects as a response

  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 πŸ§‘πŸ»β€πŸš€ - Cadet

    and you would call it from the business logic where you need to

  • USZB5JN4W
    USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

    ok, thanks πŸ™‚