Quote Term Reader API

Retrieve quote terms for a quote.

Required Editions
Available in: Salesforce CPQ Summer ’19 and later
Formats

JSON, Apex

HTTP Method

PATCH

Authentication

Authorization: Bearer token

REQUEST

Parameter 1

Name: quoteId

Type: Id

Required: Yes

Description: The quote record's ID

Parameter 2

Name: templateId

Type: Id

Required: Optional

Description: The quote template record's ID. If you don’t include the templateId parameter, the quote terms associated with the template contents don’t return.

Parameter 3

Name: language

Type: String

Required: Optional

Description: Language code when using CPQ translations.

RESPONSE

Type

QuoteTermModel

Description

The representation of SBQQ__QuoteTerm__c data

REST Examples 

1curl "https://yourInstance.salesforce.com/services/apexrest/SBQQ/
2ServiceRouter?loader=SBQQ.QuoteTermAPI.Load&uid=a0x5C000000G1CV" 
3-H "Content-Type: application/json" -H "Authorization: Bearer token" -X PATCH -d "@termContext.json"

Example request body termContext.json file for reading quote terms. The context value is a JSON-formatted string.

1{"context":"{\"templateId\": \"a0v5C000000jTgr\", \"language\": \"es\"}"}

An example response body returning two quote terms. The actual response is a JSON-formatted string.

1[
2    {
3        "value": "Hasta 10 sesiones concurrentes incluidas.",
4        "type": "Standard",
5        "standardTermId": null,
6        "quoteId": null,
7        "locked": false,
8        "label": "1",
9        "id": "a0w5C000000cbaFQAQ"
10    },
11    {
12        "value": "$ 50USD / por mes por licencia de sesión adicional.",
13        "type": "Standard",
14        "standardTermId": null,
15        "quoteId": null,
16        "locked": false,
17        "label": "1.1",
18        "id": "a0w5C000000cbaKQAQ"
19    }
20]

Apex Examples 

Before saving the QuoteTermReader example class, make sure that the CPQ model classes are added as individual Apex classes in your org.

1public with sharing class QuoteTermReader {
2    
3    public List<QuoteTermModel> load(Id quoteId, Id templateId, String language) {
4        TermContext ctx = new TermContext(templateId, language);
5        String quoteTermsJSON = SBQQ.ServiceRouter.load('SBQQ.QuoteTermAPI.Load', quoteId, JSON.serialize(ctx));
6        return (List<QuoteTermModel>) JSON.deserialize(quoteTermsJSON, List<QuoteTermModel>.class);
7    }
8
9    private class TermContext {
10        private Id templateId;
11        private String language;
12    
13        private TermContext(Id templateId, String language) {
14            this.templateId = templateId;
15            this.language = language;
16        }
17    }
18}

For an example of the QuoteTermReader class, run this code in anonymous Apex.

1QuoteTermReader quoteTermReader = new QuoteTermReader();
2List<QuoteTermModel> quoteTerms = quoteTermReader.load('a0x5C000000G1CV', 'a0v5C000000jTgr', 'es');
3System.debug(quoteTerms);