Broadleaf Microservices
  • v1.0.0-latest-prod

Content Items

Operations for retrieving Content Items.

Get Content Items

Operation

ContentClient#getContentItems(request, options);

Parameters

Parameter Type Required? Description

request

ContentResolverRequest

Represents a request to retrieve ContentItems from a commerce-facing context.

options

ClientCallOptions

Options passed to the HTTP request call to customize the request configuration.

Response

This function returns a ContentResolverResponse.

Example

Example of retrieving the content items by model name
const contentItems = await contentClient.getContentItems({
    modelName: 'Blog',
    pageRequest: {
        forward: true,
        offset: 0
    }
});

console.log(contentItems);

Get Bulk Content Items

Operation

ContentClient#getBulkContentItems(request, options);

Parameters

Parameter Type Required? Description

request

BulkContentResolverRequest

Represents a request to retrieve bulk ContentItems from a commerce-facing context.

options

ClientCallOptions

Options passed to the HTTP request call to customize the request configuration.

Response

This function returns a BulkContentResolverResponse.

Example

Example of retrieving the content items by model name
const bulkContentItems = await contentClient.getBulkContentItems({
          contentResolverRequests: [
            {
              requestId: 'one',
              modelName: 'Banner Image',
            },
            {
              requestId: 'two',
              modelName: 'Landing Page',
            },
          ],
        },
        {
          locale,
          accessToken,
        });

console.log(bulkContentItems);