allRoutes
Learn how to effectively use the allRoutes API endpoint.
The allRoutes
endpoint retrieves all active routes for a specified siteId
or for all sites. This is particularly useful for prerendering your pages.
Basic Usage
To use this endpoint, send a GET request to ${PRIMARY_SITE_URL}/v1/api/queryApi/allRoutes
to receive an array of routes for all sites.
If you want to fetch routes for a specific site, append the siteId
to the URL. For example for siteId = 1 you could use the endpoint like that: ${PRIMARY_SITE_URL}/v1/api/queryApi/allRoutes/1
.
Advanced Usage
You can pass an array as a URL parameter to the allRoutes
endpoint by encoding the array as a JSON string and then URL encoding it. This allows you to retrieve routes for multiple siteIds
in a single request.
Example
To fetch routes for siteId
1 and 2:
https://example.com/v1/api/queryApi/allRoutes?siteIds=%5B1%2C2%5D
Breakdown:
https://example.com/v1/api/queryApi/allRoutes
: Base URL of your API endpoint.?siteIds=
: Query parameter indicating you’re passing siteIds.%5B1%2C2%5D
: URL-encoded JSON string 1,2.%5B
is [%2C
is ,%5D
is ]