POST Create Cart
POST /carts
Operation ID: CreateCart. Tags: Cart.
Creates an opportunity, order, or quote based on the subaction specified in the request body. Subaction also defines method of creation. NOTE: The inputFields is not supported for AssetToOrder (subaction as assetToOrder). Subactions supported include.
createOrder - Create an empty order from the specified inputs.
createQuote - Create an empty quote from the specified inputs.
createOppty - Create an empty opportunity from the specified inputs.
assetToOrder - Create a change order initially populated from the specified assets.
assetToQuote - Create a quote for changes initially populated from the specified assets.
assetChangeSite - Create a change order to request moving the specified assets from one service location to another.
** Rest Handler - CpqCreateCartActionV2. Method Invoked - postCartItems.**
Request body (required)
Different request bodies must be used for each of the different subactions.
createOrder Request Example
{
"subaction":"createOrder",
"inputFields":[
{ "effectivedate":"2017-12-25" },
{ "status":"Draft" },
{ "Name":"New customer order" },
{ "AccountId":"0016A0000053kHN" },
{ "Pricebook2Id":"01s6A000002Y7wz" },
{ "pricebookName":"GeneralPricebook" },
{ "pricelistName":"GeneralPricelist" },
{ "vlocity_cmt__OriginatingChannel__c":"Retail" }
],
"fields":"Id,Name,EffectiveDate,AccountId,Account.Name,vlocity_cmt__EffectiveRecurringTotal__c,vlocity_cmt__EffectiveOneTimeTotal__c,vlocity_cmt__EffectiveOrderTotal__c,TotalAmount,vlocity_cmt__OriginatingChannel__c,OrderNumber,OrderReferenceNumber,Pricebook2Id,pricebookName,pricelistName"
}
createQuote Request Example
{
"subaction":"createQuote",
"inputFields":[
{ "AccountId":"0016A0000053kHN" },
{ "OpportunityId":"0066A000002aVklQAE" },
{ "status":"Draft" },
{ "Name":"New customer quote" },
{ "Pricebook2Id":"01s6A000002Y7wz" },
{ "pricebookName":"GeneralPricebook" },
{ "pricelistName":"GeneralPricelist" },
{ "vlocity_cmt__OriginatingChannel__c":"Retail" }
],
"fields":"Id,QuoteNumber,Name,OpportunityId,Status,AccountId,Account.Name,vlocity_cmt__EffectiveRecurringTotal__c,vlocity_cmt__EffectiveOneTimeTotal__c,vlocity_cmt__EffectiveQuoteTotal__c,GrandTotal,vlocity_cmt__OriginatingChannel__c,pricebookName,pricelistName"
}
createOppty Request Example
{
"subaction":"createOppty",
"inputFields":[
{ "AccountId":"0016A0000053kHN" },
{ "StageName":"Prospecting" },
{ "Name":"New customer opportunity" },
{ "Type":"New Customer" },
{ "CloseDate":"2017-12-25" },
{ "vlocity_cmt__NumberOfContractedMonths__c":24 },
{ "Pricebook2Id":"01s6A000002Y7wz" },
{ "pricebookName":"GeneralPricebook" },
{ "pricelistName":"GeneralPricelist" },
{ "vlocity_cmt__OriginatingChannel__c":"Dealer" }
],
"fields":"Id,Name,AccountId,Account.Name,vlocity_cmt__EffectiveRecurringTotal__c,vlocity_cmt__EffectiveOneTimeTotal__c,vlocity_cmt__EffectiveOpportunityTotal__c,Amount,vlocity_cmt__OriginatingChannel__c,pricebookName,pricelistName"
}
assetToOrder Request Example
{
"subaction":"assetToOrder",
"id":"01t36000000pfcKAAQ,02i6A000000YEXN",
"accountId":"0016A0000072D3y",
"requestDate":"2017-12-01"
}
For assetToOrder, if future-dated order is not available, the requestDate should be greater than or equal to current date.
If a future dated order(s) is/are available for that asset, the requestDate should be greater than or equal to
current date and should be greater than or equal to the date on all the future dated orders of the asset.
For assetToOrder, the field id can be a list of all assets or just the root asset.
The child assets will be retrived from the root asset.
assetToQuote Request Example
{
"subaction":"assetToQuote",
"listTypeAsset":"Service",
"assetIdList":[ "02i5g000000tDi8" ],
"accountId":"0015g000002vauG",
"quoteId":"0065g000002fIKa",
"opportunityId":null,
"validate":false,
"price":false
}
For assetToQuote, the parametrs "quoteId","oportunityId","validate", and "price" are optional parameters. If the user passes quoteId, then opportunityId will be ignored. If the user passes opportunityId, but not quoteId, then the API will create a new Quote for that opportunity and move assets to the created quote. If the user passes neither quoteId not opportunityId, then the API will create a new opportunity record and a new quote for that opportunity. It will then move assets to the created quote. Default values of "validate" and "price" is true. User can pass false and turn off pricing and validation.
assetChangeSite Request Example
{
"OrderId":"8014x000000Y8ZzAAK"
"moveOutDate":"2021-03-12",
"assetIdList": ["02i4x000000YzIb"],
"moveInAccountId":"0014x00000GSjX5",
"moveOutAccountId":"0014x00000Ds89r",
"subaction":"assetChangeSite"
}
``` For assetChangeSite, the parameter "OrderId" is an optional parameter. If user doesn't pass the OrderId, then new Order will be created in the parent Account of moveIn Account. If no parent Account exists, then order will be created in the move Out account. The format of "moveOutDate" parameter should be YYYY-MM-DD. The API expects Ids of all assets in a bundle to be passed-in in "assetIdList" parameter. If only some of the Ids of an Asset bundle is passed, then only the passed-in asset Ids will be considered for "Move Order" creation. It will result in incorrect "move order" behaviour.
Media type: application/json. Schema: CreateOrderBody.
Responses
- 200
OK - API request processed. Look for messages in the response to determine if it succeeded or failed.
Media type:
application/json. Schema:CreateCartResult. - 400 Bad Request - Invalid subaction or Invalid Parameters