Markus Michalski FAQ

Marketplace Redirect: Shop API

Shop API of Marketplace Redirect for headless clients: endpoint, response fields and the 404 behaviour.

Deutsche Version

Back to overview

Marketplace Redirect: Shop API

This documentation always describes the latest published version.

Dual-mode

The plugin is dual-mode: the Twig storefront and the Shop API answer the same question ("where is this product bought?") with the same logic. A headless client receives the finished URL and shows its normal add-to-cart button on a 404.

graph LR
    A["Storefront Twig hook"] --> C["Redirect provider"]
    B["Shop API request"] --> C
    C --> D["Channel setting"]
    D --> E["Link on the product"]
    E --> F["Button in the HTML"]
    E --> G["JSON response"]

Endpoint

Method Path Description
GET /api/v2/shop/marketplace-redirects/{productCode} Returns the type and URL of the external purchase for a product

The endpoint is read-only, there are no other operations.

curl "https://shop.example.com/api/v2/shop/marketplace-redirects/my-book"
{ "productCode": "my-book", "type": "amazon", "url": "https://www.amazon.de/dp/3836244764" }
Field Description
productCode Code of the product
type amazon or shopware_store
url Finished address, computed from ASIN and domain for Amazon

Error behaviour

The endpoint answers 404 for an unknown product code, a disabled product, a product that is not sold in the current channel, a product without a link and a channel in which the plugin is not switched on.

Everything that should not be visible answers with the same 404 as "no link". That way the API does not reveal that a link exists for a disabled product. A headless client shows its normal add-to-cart button on any 404.

The plugin introduces no error body of its own, the API Platform default format applies. The stored link itself is not visible through the Shop API, only this computed answer. To maintain the links, see Admin API.