Contract-based Orders

With this resource, you can add one or more new orders to an existing contract, as well as order products and custom object records for each order, or you can retrieve data for a specific contract.

Syntax 

If available, GET method retrieves the contract’s child orders and order products, as well as custom objects under the contract and orders.

URI

1/services/data/API_VERSION/commerce/sale/CONTRACT_ID

Where API_VERSION and CONTRACT_ID are variables.

For retrieving filtered data:

1/services/data/API_VERSION/commerce/sale/CONTRACT_ID?contract.orders.FIELD_NAME=VALUE

Where API_VERSION, CONTRACT_ID, FIELD_NAME and VALUE are variables.

Available since release

30.0

Formats

JSON

HTTP methods

PATCH, GET

Request body 

PropertyTypeDescriptionSince Version
attributesAttributesType of the contract.30.0
IdStringUnique contract identifier.30.0
OrdersOrders[]Child orders of the contract.30.0

Attributes 

PropertyTypeDescriptionSince Version
typeStringFormat of the resource.30.0

Order Records 

PropertyTypeDescriptionSince Version
attributesAttributesType of the order record.30.0
StatusStringStatus of the order.30.0
contractIdStringUnique record identifier for the parent contract.30.0
pricebook2IdStringUnique record identifier for the associated price book.30.0
OrderItemsOrder Products[]Child order products of the order.30.0
CUSTOM_OBJECT__rCustom Objects[]Child custom object records of the order.30.0

Order Products 

PropertyTypeDescriptionSince Version
attributesAttributesType and URL of the order product.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

Custom Objects 

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

Request parameters 

  • You can use parameters for all standard and custom fields on contracts, orders, order products, and any custom objects directly related to these objects.

  • The parameters must be fully qualified. For example: OBJECT_NAME.RELATIONSHIP_NAME.FIELD_NAME=VALUE.

    • Object name must be all lower-case.
    • Relationship name must match what is defined on the object and is case-sensitive.
    • Field name isn’t case sensitive.
    • If the value is a string, it must be encased in single quotation marks. If the value is a number, it must not be encased. If the value is a date, it should be in the YYYY-MM-DD format.
  • You can use multiple parameter fields, separated by ”&”, to make more detailed filters. For example:

    1/services/data/v30.0/commerce/sale/CONTRACT_ID?contract.status='Activated'
    2&contract.Orders.status='Draft'&contract.Orders.OrderItems.unitprice=300

    Where CONTRACT_ID is a variable.

The following aren’t supported:

  • Arrays of values. For example: contract.orders.Status='Activated','Draft'.
  • Operators: >, >=, < and <=
  • The OR condition
ParametersDescriptionSince Version
contractThe object name of the record being filtered. In this resource, this is always contract.30.0
ordersThe relationship name of the field that the order’s data will be filtered by. In this resource, this is always orders.30.0
field nameThe field whose value to filter by. For example, if you want to only retrieve orders with a status category, the field name is StatusCode.30.0
valueThe value to filter by. For example, if you want to only retrieve orders with a status category of Activated, the value is Activated.30.0

Response Body 

PropertyTypeDescription
totalSizeNumberTotal number of records retrieved.
doneBooleanWhen true, the operation was successful.
recordsRecords[]Attributes and ID of contract record.

Records 

PropertyTypeDescription
attributesAttributesType and URL of the record.
IdStringUnique contract identifier.

Attributes 

PropertyTypeDescription
typeStringFormat of the resource.
urlStringResource URL.

Examples