Back to Collection Items
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loHttp = createobject("CkHttp")
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "saver": "SBQQ.QuoteDocumentAPI.Save",
// "model": {
// "name": "test",
// "quoteId": "<SFDC_ID>",
// "templateId": "<SFDC_ID>",
// "outputFormat": "PDF",
// "language": "en_US",
// "paperSize": "Default"
// }
// }
loJson = createobject("CkJsonObject")
loJson.UpdateString("saver","SBQQ.QuoteDocumentAPI.Save")
loJson.UpdateString("model.name","test")
loJson.UpdateString("model.quoteId","<SFDC_ID>")
loJson.UpdateString("model.templateId","<SFDC_ID>")
loJson.UpdateString("model.outputFormat","PDF")
loJson.UpdateString("model.language","en_US")
loJson.UpdateString("model.paperSize","Default")
// Adds the "Authorization: Bearer <access_token>" header.
loHttp.AuthToken = "<access_token>"
loHttp.SetRequestHeader("Content-Type","application/json")
loResp = loHttp.PostJson3("https://domain.com/services/apexrest/SBQQ/ServiceRouter?loader=QuoteDocumentAPI.SaveProposal","application/json",loJson)
if (loHttp.LastMethodSuccess = .F.) then
? loHttp.LastErrorText
release loHttp
release loJson
return
endif
? str(loResp.StatusCode)
? loResp.BodyStr
release loResp
release loHttp
release loJson
Curl Command
curl -X POST
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-d '{
"saver": "SBQQ.QuoteDocumentAPI.Save",
"model": {
"name": "test",
"quoteId": "<SFDC_ID>",
"templateId": "<SFDC_ID>",
"outputFormat": "PDF",
"language": "en_US",
"paperSize": "Default"
}
}'
https://domain.com/services/apexrest/SBQQ/ServiceRouter?loader=QuoteDocumentAPI.SaveProposal
Postman Collection Item JSON
{
"name": "Generate Quote Document API",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"saver\": \"SBQQ.QuoteDocumentAPI.Save\",\n \"model\": {\n \"name\": \"test\",\n \"quoteId\": \"<SFDC_ID>\",\n \"templateId\": \"<SFDC_ID>\",\n \"outputFormat\": \"PDF\",\n \"language\": \"en_US\",\n \"paperSize\": \"Default\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{_endpoint}}/services/apexrest/SBQQ/ServiceRouter?loader=QuoteDocumentAPI.SaveProposal",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"apexrest",
"SBQQ",
"ServiceRouter"
],
"query": [
{
"key": "loader",
"value": "QuoteDocumentAPI.SaveProposal"
}
]
},
"description": "Creates and saves a CPQ quote document.\nAvailable in: Salesforce CPQ Winter ’19 and later\n\nhttps://developer.salesforce.com/docs/atlas.en-us.cpq_dev_api.meta/cpq_dev_api/cpq_api_generate_proposal.htm"
},
"response": [
]
}