Markus Michalski FAQ

XML Sitemap Generator: Admin API

Admin API endpoints of the XML Sitemap Generator: generate the sitemap for a Sales Channel and fetch URL statistics, with authentication, response format and error cases.

Deutsche Version

Back to overview

XML Sitemap Generator: Admin API

Live Demo: Try this and other plugins live — no installation, no risk: demo.markus-michalski.net

The Manual Generation card in the plugin configuration calls two routes of the Shopware Admin API. You can also call them from your own scripts or integrations. Both routes expect a valid Admin API token (Authorization: Bearer <token>).

Method Route Purpose
POST /api/_action/mmd-sitemap/generate/{salesChannelId} Generate the Sales Channel's sitemap
GET /api/_action/mmd-sitemap/stats/{salesChannelId} Fetch the URL count per type

{salesChannelId} is the Sales Channel ID as a UUID in hex notation. The API answers an invalid ID with HTTP 400.

The routes are protected with the privileges mmd_sitemap.generate and mmd_sitemap.stats. The plugin does not register these privileges in the role management. The routes are therefore reliably usable for administrators and for integrations with administrator rights.

Generate a sitemap

curl -X POST "https://your-shop.com/api/_action/mmd-sitemap/generate/019b7dfcab75700fada02799328e8440" \
  -H "Authorization: Bearer <token>" \
  -H "Accept: application/json"

The route generates all enabled types and first deletes the existing sitemap*.xml files in the Sales Channel's target directory. It needs no request body.

Response:

{
  "success": true,
  "filesWritten": ["sitemap-products.xml", "sitemap-categories.xml", "sitemap.xml"],
  "totalUrlCount": 1234,
  "duration": 1.82,
  "error": ""
}
Field Meaning
success true if at least one file was written and there is no error
filesWritten File names of the files written, the index sitemap.xml last
totalUrlCount Number of URLs across all type files
duration Duration in seconds
error Error message, otherwise empty

If an error occurs, the route answers with HTTP 500 and the general message Sitemap generation failed. Check logs for details.; details are in the Shopware log.

Fetch statistics

curl "https://your-shop.com/api/_action/mmd-sitemap/stats/019b7dfcab75700fada02799328e8440" \
  -H "Authorization: Bearer <token>"

Response:

{
  "counts": {"products": 1000, "categories": 40, "cms": 8},
  "total": 1048
}

counts contains one key per enabled type (products, categories, cms, manufacturers). The values are approximations, see Generation and console command. On an error the route answers with HTTP 500 and empty counts.