Migrate Glue REST API to API Platform

Edit on GitHub

This document guides you through migrating storefront Glue REST API endpoints to API Platform. The migration replaces legacy *RestApi Glue modules with API Platform resources defined in core Spryker modules.

Overview

In this migration, every legacy Glue REST API resource — route plugins, relationship plugins, and resource route builders — is replaced by API Platform resources. The new resources are defined declaratively in YAML schemas inside core Spryker modules and auto-discovered by the framework.

You can migrate module by module. During migration, both the legacy Glue router and the API Platform router run side by side, so unmigrated endpoints continue to work.

Prerequisites

Before starting, make sure you have completed:

Cross-cutting changes

If your project has customized Glue REST API behavior at the project level (src/Pyz/), complete the project-level cleanup steps described in Migrate project-level customizations. This guide covers:

  • Removing migrated route and relationship plugins from GlueApplicationDependencyProvider
  • Removing migrated resource plugins from GlueStorefrontApiApplicationDependencyProvider and GlueBackendApiApplicationDependencyProvider
  • Deleting obsolete Pyz *RestApi modules and creating their API Platform replacements
  • Migrating custom plugin implementations to new extension interfaces
  • Migrating custom REST API endpoints to the API Platform Provider/Processor pattern

You can complete these steps before, during, or after the per-module migrations. Each section can be done independently as you migrate the corresponding module.

Per-module migration guides

After completing the cross-cutting changes, migrate individual modules by following the guides below. Each guide lists the modules to update, plugins to add, and legacy plugins to remove.

Migration order

You can migrate modules in any order. We recommend starting with simpler read-only resources and progressing to more complex ones.

Module to migrate Replaces legacy module Guide
Agent AgentAuthRestApi Migrate AgentAuthRestApi
Authentication AuthRestApi Migrate AuthRestApi
Availability ProductAvailabilitiesRestApi Migrate ProductAvailabilitiesRestApi
Cart CartsRestApi Migrate CartsRestApi
CartCode CartCodesRestApi Migrate CartCodesRestApi
Catalog CatalogSearchRestApi Migrate CatalogSearchRestApi
Category CategoriesRestApi Migrate CategoriesRestApi
Checkout CheckoutRestApi Migrate CheckoutRestApi
Company CompaniesRestApi Migrate CompaniesRestApi
CompanyUser CompanyUsersRestApi, CompanyUserAuthRestApi Migrate CompanyUsersRestApi and CompanyUserAuthRestApi
CompanyBusinessUnit CompanyBusinessUnitsRestApi Coming soon
CompanyRole CompanyRolesRestApi Coming soon
CompanyUnitAddress CompanyBusinessUnitAddressesRestApi Coming soon
ContentProduct ContentProductAbstractListsRestApi Migrate ContentProductAbstractListsRestApi
Customer CustomersRestApi Migrate CustomersRestApi
CustomerAccess CustomerAccessRestApi Migrate CustomerAccessRestApi
Merchant MerchantsRestApi Migrate MerchantsRestApi
MerchantOpeningHours MerchantOpeningHoursRestApi Migrate MerchantOpeningHoursRestApi
MerchantProductOffer MerchantProductOffersRestApi Migrate MerchantProductOffersRestApi
Navigation NavigationsRestApi Migrate NavigationsRestApi
Oauth OauthApi Migrate OauthApi
Payment PaymentsRestApi, OrderPaymentsRestApi Migrate OrderPaymentsRestApi and PaymentsRestApi
PriceProduct ProductPricesRestApi Migrate ProductPricesRestApi
PriceProductOffer ProductOfferPricesRestApi Migrate ProductOfferPricesRestApi
Product ProductsRestApi Migrate ProductsRestApi
ProductAlternative AlternativeProductsRestApi Migrate AlternativeProductsRestApi
ProductAttribute ProductAttributesRestApi Migrate ProductAttributesRestApi
ProductBundle ProductBundlesRestApi Migrate ProductBundlesRestApi
ProductImage ProductImageSetsRestApi Migrate ProductImageSetsRestApi
ProductLabel ProductLabelsRestApi Migrate ProductLabelsRestApi
ProductMeasurementUnit ProductMeasurementUnitsRestApi Migrate ProductMeasurementUnitsRestApi
ProductOfferAvailability ProductOfferAvailabilitiesRestApi Migrate ProductOfferAvailabilitiesRestApi
ProductOfferServicePointAvailability ProductOfferServicePointAvailabilitiesRestApi Migrate ProductOfferServicePointAvailabilitiesRestApi
ProductOption ProductOptionsRestApi Migrate ProductOptionsRestApi
ProductReview ProductReviewsRestApi Migrate ProductReviewsRestApi
QuoteRequest QuoteRequestsRestApi, QuoteRequestAgentsRestApi Migrate QuoteRequestsRestApi and QuoteRequestAgentsRestApi
Sales OrdersRestApi Migrate OrdersRestApi
ServicePoint ServicePointsRestApi Coming soon
SharedCart SharedCartsRestApi Migrate SharedCartsRestApi
SharedCart CartPermissionGroupsRestApi Migrate CartPermissionGroupsRestApi
ShipmentType ShipmentTypesRestApi Migrate ShipmentTypesRestApi
Store StoresRestApi, StoresApi Migrate StoresRestApi
Tax ProductTaxSetsRestApi Migrate ProductTaxSetsRestApi
TaxApp TaxAppRestApi Migrate TaxAppRestApi
DiscountPromotion DiscountPromotionsRestApi Coming soon
SalesOrderAmendment OrderAmendmentsRestApi Coming soon

After each module migration

After migrating each module, regenerate transfers, API resources, and clear the cache:

docker/sdk cli console transfer:generate
docker/sdk cli glue api:generate
docker/sdk cli glue cache:clear

Final cleanup

Once all modules have been migrated, perform the following cleanup steps.

Remove legacy Glue router

In src/Pyz/Glue/Router/RouterDependencyProvider.php, remove new GlueRouterPlugin() from getRouterPlugins().

Delete obsolete project-level overrides

For the full list of Pyz modules to delete and their replacements, see Migrate project-level customizations: Delete obsolete Pyz RestApi modules.

After the cleanup, you can also remove unused *RestApi composer dependencies and clean up empty Glue module directories.