Marketplace Redirect: Admin API
Admin API of Marketplace Redirect: create, change and delete links by import or automation, fields, response codes and filter.
Marketplace Redirect: Admin API
This documentation always describes the latest published version.
The Admin API maintains the stored links, for example by import or automation. All operations need an admin token with ROLE_API_ACCESS. GraphQL is not exposed for this resource.
Operations
| Operation | Endpoint |
|---|---|
List (filter ?product=/api/v2/admin/products/{code}) |
GET /api/v2/admin/product-marketplace-links |
| Read | GET /api/v2/admin/product-marketplace-links/{id} |
| Create | POST /api/v2/admin/product-marketplace-links |
| Change | PUT /api/v2/admin/product-marketplace-links/{id} |
| Delete | DELETE /api/v2/admin/product-marketplace-links/{id} |
{
"product": "/api/v2/admin/products/my-book",
"type": "amazon",
"reference": "3836244764",
"amazonDomain": "de"
}
Fields
| Field | Rules |
|---|---|
product |
IRI of the product. Required on create, ignored on change (a link stays with its product). A product has at most one link |
type |
amazon or shopware_store. Omitted on create, it is amazon |
reference |
amazon: the ASIN, exactly 10 letters and digits. shopware_store: an https://store.shopware.com/... product URL. Surrounding whitespace is trimmed |
amazonDomain |
amazon links only: de, com, co.uk, fr, it, es, nl, pl, se or ca. null uses the default domain. Any other type needs null |
Response codes
| Code | When |
|---|---|
| 201 | Link created (POST) |
| 204 | Link deleted (DELETE) |
| 401 / 403 | The token is missing or does not have the ROLE_API_ACCESS role |
| 404 | GET, PUT or DELETE with an unknown ID |
| 422 | A second link for a product, a reference that does not fit its type, an unknown domain, a domain on a store link, a missing product. The violations are listed per field in the response |
| 400 | An unknown type or an unknown product IRI |
The reference and domain rules are the ones of the product form. The only difference: the form drops a domain on a store link without a message, the API rejects it with 422. If two requests create a link for the same product at the same time, the losing request also gets a 422 instead of a database error.
Filter and partial updates
The product filter takes one product IRI or several (product[]=...&product[]=...). A value that does not name an existing product (unknown code, not an IRI, an empty value) matches nothing: the list is empty and the request still succeeds. With several values, one unknown IRI empties the whole list, whatever its position.
PUT is a partial update: a field you leave out keeps its stored value. When you switch a link from amazon to shopware_store, send "amazonDomain": null along with the new reference. Deleting a link puts the product back to the normal add-to-cart button.
Example: create a link and remove it again
curl -X POST "https://shop.example.com/api/v2/admin/product-marketplace-links" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"product":"/api/v2/admin/products/my-book","reference":"3836244764"}'
curl -X DELETE "https://shop.example.com/api/v2/admin/product-marketplace-links/12" \
-H "Authorization: Bearer $TOKEN"
Without type, the first call creates an Amazon link with the default domain.