Create Cart

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

Opportunity

{
 "methodName": "createCart",
 "objectType": "Opportunity"
 "inputFields": [{
  "Name": "TestOpportunity"
 }, {
  "StageName": "Prospecting"
 }, {
  "CloseDate": "3/19/2020"
 }, {
  "AccountId": "00141000009erCBAAY"
 }],
 "subaction": "createOppty",
 "fields": "Id,Name,StageName"
}

Order

{
 "methodName": "createCart",
 "objectType": "Order",
 "inputFields": [{
  "effectivedate": "12/7/2019"
 }, {
  "status": "Draft"
 }, {
  "Name": "Telco"
 }, {
  "AccountId": "00141000009erCBAAY"
 }],
 "subaction": "createOrder",
 "fields": "Id,Name,EffectiveDate"
}

Quote

{
 "methodName": "createCart",
 "objectType": "Quote",
 "inputFields": [{
  "OpportunityId": "6DG678HD234"
 }, {
  "Name": "Telco"
 }, {
  "AccountId": "00141000009erCBAAY"
 }],
 "subaction": "createQuote",
 "fields": "Id,Name"
}

Communication (vlocity__cmt)

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".

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

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.

POST /services/apexrest/vlocity_cmt/v2/carts
Body:
{
  "inputFields": [
    {
      "Name": "Headless CPQ Oppty"
    },
    {
      "StageName": "Prospecting"
    },
    {
      "CloseDate": "6/19/2020"
    },
    {
      "AccountId": "0011U00000W6H9p"
    }
  ],
  "filters": "Account.vlocity_cmt__Status__c:Inactive_Active_Pending",
  "subaction": "createOppty",
  "fields": "Id,Name,StageName"
}

Order

POST /services/apexrest/vlocity_cmt/v2/carts
Body:
{
  "methodName": "createCart",
  "objectType": "Order",
  "inputFields": [
    {
      "effectivedate": "12/03/2019"
    },
    {
      "status": "Draft"
    },
    {
      "Name": "Headless CPQ Order"
    },
    {
      "AccountId": "0011U00000W6GvB"
    }
  ],
  "subaction": "createOrder",
  "fields": "Id,Name,EffectiveDate"
}

Quote

POST /services/apexrest/vlocity_cmt/v2/carts
Body:
{
  "methodName": "createCart",
  "objectType": "Quote",
  "inputFields": [
    {
      "OpportunityId": "0061U000008fIUK"
    },
    {
      "Name": "Headless CPQ Quote"
    }
  ],
  "subaction": "createQuote",
  "fields": "Id,Name"
}


Asset to Order

POST /services/apexrest/vlocity_cmt/v2/carts
Body:
{
  "subaction":"assetToOrder",
  "id":"01t36000000pfcKAAQ,02i6A000000YEXN",
  "accountId":"0016A0000072D3y",
  "requestDate":"2019-12-01"
}

See Also