Skip to content
View as Markdown
View as Markdown

@salesforce/b2c-tooling-sdk / clients / createPreferencesClient

Function: createPreferencesClient()

createPreferencesClient(config, auth, options?): PreferencesClient

Defined in: packages/b2c-tooling-sdk/src/clients/preferences.ts:99

Creates a typed Preferences API client.

Authentication is handled by middleware. The client automatically attaches:

  • Domain scope: sfcc.preferences (read) or sfcc.preferences.rw (read-write)
  • Tenant scope: SALESFORCE_COMMERCE_API:{tenantId}

Parameters

config

PreferencesClientConfig

auth

AuthStrategy

options?

PreferencesClientOptions

Returns

PreferencesClient

Example

typescript
const client = createPreferencesClient(
  {shortCode: 'kv7kzm78', tenantId: 'zzxy_prd'},
  oauthStrategy,
);

const {data} = await client.GET('/organizations/{organizationId}/global-custom-preferences', {
  params: {path: {organizationId: toOrganizationId('zzxy_prd')}},
});

Released under the Apache-2.0 License.