Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Json
oleobject loo_Resp
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// 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"
// }
// }
loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
loo_Json.UpdateString("saver","SBQQ.QuoteDocumentAPI.Save")
loo_Json.UpdateString("model.name","test")
loo_Json.UpdateString("model.quoteId","<SFDC_ID>")
loo_Json.UpdateString("model.templateId","<SFDC_ID>")
loo_Json.UpdateString("model.outputFormat","PDF")
loo_Json.UpdateString("model.language","en_US")
loo_Json.UpdateString("model.paperSize","Default")
// Adds the "Authorization: Bearer <access_token>" header.
loo_Http.AuthToken = "<access_token>"
loo_Http.SetRequestHeader("Content-Type","application/json")
loo_Resp = loo_Http.PostJson3("https://domain.com/services/apexrest/SBQQ/ServiceRouter?loader=QuoteDocumentAPI.SaveProposal","application/json",loo_Json)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Json
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp
destroy loo_Http
destroy loo_Json
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": [
]
}