Create Cart

Create an opportunity, order, or quote based on the header object.

1POST /v2/carts

Remote Method 

1createCart

REST Handler 

1CpqCreateCartActionV2

Apex Remote Service 

1CpqAppHandler

Apex Remote Input Maps 

Opportunity

1{
2 "methodName": "createCart",
3 "objectType": "Opportunity"
4 "inputFields": [{
5  "Name": "TestOpportunity"
6 }, {
7  "StageName": "Prospecting"
8 }, {
9  "CloseDate": "3/19/2020"
10 }, {
11  "AccountId": "00141000009erCBAAY"
12 }],
13 "subaction": "createOppty",
14 "fields": "Id,Name,StageName"
15}

Note

Order

1{
2 "methodName": "createCart",
3 "objectType": "Order",
4 "inputFields": [{
5  "effectivedate": "12/7/2019"
6 }, {
7  "status": "Draft"
8 }, {
9  "Name": "Telco"
10 }, {
11  "AccountId": "00141000009erCBAAY"
12 }],
13 "subaction": "createOrder",
14 "fields": "Id,Name,EffectiveDate"
15}

Note

Quote

1{
2 "methodName": "createCart",
3 "objectType": "Quote",
4 "inputFields": [{
5  "OpportunityId": "6DG678HD234"
6 }, {
7  "Name": "Telco"
8 }, {
9  "AccountId": "00141000009erCBAAY"
10 }],
11 "subaction": "createQuote",
12 "fields": "Id,Name"
13}

Note

Package 

Communication (vlocity__cmt)

API Parameters and response format 

By default, you can only create carts for active accounts. If the account is in a status besides active, add this filter to your request: "filters": "Account.vlocity_cmt__Status__c:Inactive_Active_Pending".

Resource Information 

Response FormatJSON
Resource URL/services/apexrest/{namespace}/v2/carts

Example Requests 

Opportunity

In this example, the status of the account isn’t Active. Therefore, we also specify "filters": "Account.vlocity_cmt__Status__c:Inactive_Active_Pending" in the request.

1POST /services/apexrest/vlocity_cmt/v2/carts
2Body:
3{
4  "inputFields": [
5    {
6      "Name": "Headless CPQ Oppty"
7    },
8    {
9      "StageName": "Prospecting"
10    },
11    {
12      "CloseDate": "6/19/2020"
13    },
14    {
15      "AccountId": "0011U00000W6H9p"
16    }
17  ],
18  "filters": "Account.vlocity_cmt__Status__c:Inactive_Active_Pending",
19  "subaction": "createOppty",
20  "fields": "Id,Name,StageName"
21}

Note

Order

1POST /services/apexrest/vlocity_cmt/v2/carts
2Body:
3{
4  "methodName": "createCart",
5  "objectType": "Order",
6  "inputFields": [
7    {
8      "effectivedate": "12/03/2019"
9    },
10    {
11      "status": "Draft"
12    },
13    {
14      "Name": "Headless CPQ Order"
15    },
16    {
17      "AccountId": "0011U00000W6GvB"
18    }
19  ],
20  "subaction": "createOrder",
21  "fields": "Id,Name,EffectiveDate"
22}

Note

Quote

1POST /services/apexrest/vlocity_cmt/v2/carts
2Body:
3{
4  "methodName": "createCart",
5  "objectType": "Quote",
6  "inputFields": [
7    {
8      "OpportunityId": "0061U000008fIUK"
9    },
10    {
11      "Name": "Headless CPQ Quote"
12    }
13  ],
14  "subaction": "createQuote",
15  "fields": "Id,Name"
16}

Note

Asset to Order

1POST /services/apexrest/vlocity_cmt/v2/carts
2Body:
3{
4  "subaction":"assetToOrder",
5  "id":"01t36000000pfcKAAQ,02i6A000000YEXN",
6  "accountId":"0016A0000072D3y",
7  "requestDate":"2019-12-01"
8}

Note

See Also