Alokai

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

NameRequiredTypeDescription
propsRequiredUrlMappingGetParamsParameter 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

  • UrlMappingGetParams
  • UrlMappingGetResponse

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);

On this page