You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x
getProductReferences
Get list of product references from SAP Commerce Cloud.
This method receives data from the getProductReferences endpoint exposed by the SAP OCC API Products Controller.
Signature
export declare function getProductReferences(
context: SapccIntegrationContext,
props: GetProductReferencesProps
): Promise<ProductReferenceList>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
context | Required | SapccIntegrationContext | |
props | Required | GetProductReferencesProps | 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 Product Reference List.
Referenced Types
Examples
Fetching references for a product with a specific productCode.
import { sdk } from '~/sdk';
const productReferences = await sdk.commerce.getProductReferences({ productCode: '1992695' });Using the method the way it will be possible to cache the response.
import { sdk } from '~/sdk';
const productReferences = await sdk.commerce.getProductReferences({ productCode: '1992695', lang: 'en', currency: 'GBP' });Fetching a limited number of references for a product using the pageSize parameter.
import { sdk } from '~/sdk';
const productReferences = await sdk.commerce.getProductReferences({ productCode: '1992695', pageSize: 2 });Fetching references of a specific type using the referenceType parameter.
import { sdk } from '~/sdk';
const productReferences = await sdk.commerce.getProductReferences({ productCode: '1992695', referenceType: ProductReferenceTypeEnum.ACCESSORIES });Fetching references for a specific product and selecting response fields.
import { sdk } from '~/sdk';
const productReferences = await sdk.commerce.getProductReferences({ productCode: '1992695', fields: 'references(description,target(FULL))' });