Spree Legacy API v2
⚠️ DEPRECATED: This gem provides the legacy API v2 endpoints for Spree Commerce. We recommend using API v3.
Overview
This gem contains the legacy Storefront API v2 and Platform API v2 endpoints that were previously part of spree_api. These APIs are now deprecated in favor of the new API v3, which is much simpler, faster and more secure.
Installation
Add this line to your application's Gemfile:
gem 'spree_legacy_api_v2'And run the following command:
bundle exec rake spree_legacy_api_v2:installThis will install the database migrations and run them.
Migration Guide
Storefront API
The new Store API v3 provides similar functionality with improved consistency:
| Legacy v2 Endpoint | New v3 Endpoint |
|---|---|
GET /api/v2/storefront/products |
GET /api/v3/store/products |
GET /api/v2/storefront/cart |
GET /api/v3/store/orders/:id |
POST /api/v2/storefront/cart/add_item |
POST /api/v3/store/orders/:id/line_items |
GET /api/v2/storefront/account |
GET /api/v3/store/customers |
Key Differences
- Serialization: API v3 uses Alba serializers (faster, simpler) instead of JSONAPI::Serializer
- Response Format: API v3 returns simple JSON objects instead of JSONAPI format
- Authentication: API v3 requires publishable key authentication for Store API and uses JWT tokens for user authentication
- TypeScript Types: API v3 automatically generates TypeScript types via Typelizer
License
Spree is released under the AGPL-3.0-or-later and BSD-3-Clause licenses.