---
schema_version: "1"
id: b717c36baae409fdea331745b9ab3b83b6bfb165a764483d38001f8b845450ba
title: Use Promotion Business Objects API
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/retail_api/cg_tpm_use_promotion_business_objects_api.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cg_tpm_use_promotion_business_objects_api.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 0f7b2e97e33a5822424e1d4dcc743dbb7e0a3aba8cccf2e8db294d483fcb73b8
description: Promotion Business Object API can be accessed through REST API, Aura Components, and Lightning Web Component.
---
# Use Promotion Business Objects API

Promotion Business Object API can be accessed through REST API, Aura Components, and Lightning Web Component.

## REST API

![Note](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/images/icon_note.png)

#### Note

Use an external system (such as cURL, Postman, or middleware) to call this API. These endpoints are designed for external integration and cannot be invoked from Apex code within the same org (such as Execute Anonymous, Flows, or Triggers using Http.send()) due to Salesforce platform restrictions on loopback callouts. If attempted, the platform returns a "Callout loop not allowed" error.

To process records with Promotion BO API, you need to use the provided REST endpoints in the defined process:

1. Initialize a transaction with the number of records to process:
    1. URL: <ORG INSTANCE>/services/apexrest/cgcloud/promotions/initialize
        
        METHOD: POST
        
        PAYLOAD:
        
        {
            “nrOfItems” : 500, // Number of records for the transaction
            “salesOrg”: “0001” // Sales Org of the records
        }
        
        ![Note](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/images/icon_note.png)
        
        #### Note
        
        To prevent flagging all promotions in a transaction as calculation errors, set nrOfItems to the exact number of promotions to be processed.
    2. This request returns an import ID that should be passed to every subsequent requests.
2. Queue the records to process in blocks of 50 records.
    1. URL: <ORG INSTANCE>/services/apexrest/cgcloud/promotions/ingest
        
        METHOD: POST
        
        PAYLOAD:
        
        {
            “importId” : ”3121b14e-f370-4c1b-8b09-b9323ea38216”, // Import Id received from previous request.
            “workflow”: “create” // Workflow name to execute
            “salesOrg” : “0001” // Sales org
            “promotions”: \[...\] // Array of up to 50 records where each record represents a Promotion.
        }
    2. Each call can contain up to 50 records.
    3. You can send as many requests to fill the “nrOfItems” defined in the request sent to initialize a transaction.
3. Monitor the process.
    1. URL: <ORG INSTANCE>/services/apexrest/cgcloud/promotions/status?importId=<import Id>
        
        METHOD: GET
    2. This returns the status for all records part of the transaction.

## Aura

You can send requests to the Promotion BO API from an Aura Component.

Component markup

...
<cgcloud:PromotionBoApi aura:id="bo-api"></cgcloud:PromotionBoApi>
...

Component controller

...
const boApi = component.find("bo-api");

// Receives a workflow name and a list of promotion objects
// Supports up to 10000 records
boApi.queue(workflowName, promotionList) 
.then((result) => {
    // Resolves after the promotions have been enqueued for BO API processing
    // returns the import id
    // Promotions are processed asynchronously
});

// Receives a workflow name and a single promotion
boApi.process(workflowName, promotion) 
.then((result) => {
    // Resolves after the promotion has been processed and committed to database (synchronous)
    // Result contains the processed promotion id 
});
...

## Lightning Web Component

![Note](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/images/icon_note.png)

#### Note

Only available when Lightning Web Security is enabled in the organization.

Component controller

import { process, queue } from 'cgcloud/tpmBoApi';

...
// Receives a workflow name and a list of promotion objects
// Supports up to 10000 records
queue('Promotion', workflowName, promotionList) 
.then((result) => {
    // Resolves after the promotions have been enqueued for BO API processing
    // returns the import id
    // Promotions are processed asynchronously
});

// Receives a workflow name and a single promotion
process('Promotion', workflowName, promotion) 
.then((result) => {
    // Resolves after the promotion has been processed and committed to database (synchronous)
    // Result contains the processed promotion id 
});
...