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..

Hello, i am creating a versioning for the rest api. By default the newest version is always taken. I

U01GS2RAPFS
U01GS2RAPFS Posts: 14 🧑🏻‍🚀 - Cadet

Hello,
i am creating a versioning for the rest api. By default the newest version is always taken. Is it possible, if no "Content-Type: application/vnd.api+json; version=2.0" is sent with to choose automatically the oldest version?

Comments

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer

    Yes, just implement your own VersionResolver which needs to implement Spryker\Glue\GlueApplication\Rest\Version\VersionResolverInterface and override the Spryker one.
    Here you can implement the fallback to “the oldest version”, what ever that means in your application.
    It might be necessary to go through the whole

    GlueApplicationDependencyProvider::PLUGIN_RESOURCE_ROUTES
    

    which contain all registered glue route plugins.

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer

    All this can be placed into the Pyz\Glue\GlueApplication namespace