URL Resolution

The Get URL Mapping endpoint allows headless storefronts to support localized, user-friendly URLs based on URL rules set up in Business Manager. This endpoint helps you to increase your site traffic and improve site navigation.

For example, you identify “new arrivals” as a valuable search term and you add a route (URL: www.example./new-arrivals) to your storefront. You can use a rule in Business Manager to map that URL to a category list page for new arrivals. Then you can use the Get URL Mapping endpoint to apply the rule when a shopper:

  • Searches for new arrivals
  • Clicks or types in this URL: www.example.com/new-arrivals

To use the Get URL Mapping endpoint, you must first:

In this example, we use a cURL command to call the Get URL Mapping endpoint to resolve this URL that a shopper clicked or typed in: www.example.com/blue/new-arrivals/tops.

As shown in the response, the URL is mapped to a category called new-arrivals-tops:

  • The Get URL Mapping endpoint:
    • Can resolve URLs for these types of resources: product, category (including category refinements), and content (Page Designer) assets
    • Applies only to the types of rules described in URL Rules for SEO
  • You can pass a locale into the Get URL Mapping endpoint. However, if you don’t, the endpoint falls back to the default locale of the site as configured in Business Manager.
  • Add wildcard mappings to your routes flow as the final step in the sequence.
  • By inserting this endpoint into your routes flow you‘re adding another database call to resolve requests on your website. To optimize for performance, we recommend that you:
    • Set long time-to-live (TTL) values for the Get URL Mapping endpoint. (The default TTL is 12 hours.)
    • Use this endpoint as a fallback after attempting to resolve URLs with your routing engine. First try to use routes that are semantic and interpretable by your routing engine. For example: /categories/[categoryFriendlyName]/[categoryId].