Alokai
You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x

getConsentTemplates

Get list of all consent templates from SAP Commerce Cloud.

This method receives data from the getConsentTemplates endpoint exposed by the SAP OCC API Consents Controller.

When vsf-sap-token cookie is present in the request, this method will fetch consent templates for the current user. In case there is no cookie, it will fetch them for an anonymous user.

Signature

export declare function getConsentTemplates(
	context: SapccIntegrationContext,
	props?: BaseProps & BaseUserId
): Promise<ConsentTemplateList>;

Parameters

NameRequiredTypeDescription
contextRequiredSapccIntegrationContext
propsOptionalBaseProps & BaseUserIdParameter object which can be used with this method. Refer to its type definition to learn about possible properties.

Returns

Returns a representation of a Consent Template List.

Referenced Types

Examples

Fetching a list of consent templates.

import { sdk } from '~/sdk';

const { consentTemplates } = await sdk.commerce.getConsentTemplates();

Fetching a list of consent templates and selecting response fields.

import { sdk } from '~/sdk';

const { consentTemplates } = await sdk.commerce.getConsentTemplates({
  fields: 'consentTemplates(id,name)'
});

On this page