getUrlMapping
Gets URL mapping information for a URL that a shopper clicked or typed in. The mapping information is based on URL rules and redirects set up in Business Manager. For more information about prerequisites and sample usage, see URL Resolution. You can customize the behavior of this endpoint by using hooks. See the hooks for getUrlMapping in the Hook List.
Calls the getUrlMapping endpoint exposed by SCAPI.
Signature
export declare function getUrlMapping(
props: UrlMappingGetParams
): Promise<UrlMappingGetResponse>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | UrlMappingGetParams | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
Returns
Returns a representation of a URL mapping.
Referenced Types
UrlMappingGetParamsUrlMappingGetResponse
Examples
Getting the mapping of a url for the current locale.
import { sdk } from '~/sdk.config.ts';
const data: UrlMappingGetParams = {
urlSegment: '/some/url'
};
const mapping = await sdk.commerce.getUrlMapping(data);Getting the mapping of a url for a specific locale.
import { sdk } from '~/sdk.config.ts';
const data: UrlMappingGetParams = {
locale: 'en-US',
urlSegment: '/some/url'
};
const mapping = await sdk.commerce.getUrlMapping(data);