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

getUser

Get customer profile from SAP Commerce Cloud.

This method exchanges data with the getUser endpoint exposed by the SAP OCC API Users Controller.

The method fetches a customer profile based on the vsf-sap-token cookie (which is assigned to that customer). The cookie must be present in the request for the method to work properly.

Signature

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

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 User.

Referenced Types

Examples

Fetching a customer profile.

import { sdk } from '~/sdk';

const user = await sdk.commerce.getUser();

Fetching a customer profile and selecting response fields.

import { sdk } from '~/sdk';

const user = await sdk.commerce.getUser({ fields: 'uid,firstName' });

On this page