Create Contract-based Orders

With this resource, you can create a new contract with orders and order products, as well as custom object records on the contract or order level.

Syntax 

URI

1/services/data/API_VERSION/commerce/sale

Where API_VERSION is a variable.

Available since release

30.0

Formats

JSON

HTTP methods

POST

Request body 

PropertyTypeDescriptionSince Version
attributesAttributesType and URL of the new contract.30.0
AccountIdStringUnique record identifier for the parent account.30.0
StatusStringStatus of the contract.30.0
OrdersOrders[]Child orders of the new contract.30.0
CUSTOM_OBJECT__rCustom Objects[]Child custom object records of the new contract.30.0

Attributes 

PropertyTypeDescriptionSince Version
typeStringFormat of the resource.30.0

Orders 

PropertyTypeDescriptionSince Version
attributesAttributesType and URL of the new order record.30.0
StatusStringStatus of the order.30.0
Pricebook2IdStringUnique record identifier for the associated price book.30.0
OrderItemsOrder Products[]Child order products of the new order.30.0
CUSTOM_OBJECT__rCustom Objects[]Child custom object records of the new order.30.0

Custom Object Records 

PropertyTypeDescriptionSince Version
attributesAttributesType and URL of the custom object record.30.0
IdStringUnique record identifier.30.0

Order Products 

PropertyTypeDescriptionSince Version
attributesAttributesType and URL of the order product record.30.0
PricebookEntryIdStringUnique record identifier for the associated price book entry.30.0
quantityNumberNumber of units of the order product.30.0
UnitPriceCurrencyThe unit price for the order product.30.0

Request parameters 

None

Response Body 

PropertyTypeDescription
totalSizeNumberTotal number of records added.
doneBooleanWhen true, the operation was successful.
recordsRecords[]Attributes and IDs of records.

Records 

PropertyTypeDescription
attributesAttributesType and URL for the new record.
IdStringUnique identifier for the new record.

Attributes 

PropertyTypeDescription
typeStringFormat of the resource.
urlStringResource URL.

Example 

See Add a Contract and Orders to an Existing Account.

Usage 

You can only create one contract at a time. You can’t POST new orders onto an existing contract. For that, see the Contract-based Orders resource.