Order

Use this resource to add one or more new order products and custom object records to an existing order or to retrieve data for a specific order.

Syntax 

You can only PATCH one order at a time.

If available, GET method retrieves the orders’ child order products and custom objects under the order or order products.

URI

1/services/data/API_VERSION/commerce/sale/order/ORDER_ID

Where API_VERSION and ORDER_ID are variables.

For retrieving filtered data:

1/services/data/API_VERSION/commerce/sale/order/ORDER_ID?order.orderItems.FIELD_NAME=VALUE

Where API_VERSION, ORDER_ID, FIELD_NAME and VALUE are variables.

Available since release

30.0

Formats

JSON

HTTP methods

POST

Request body 

PropertyTypeDescriptionSince Version
attributesAttributesType and URL of the order.30.0
OrderItemsOrder ProductsChild order products of the new order.30.0
CUSTOM_OBJECT__rCustom ObjectChild custom object records of the new order.30.0

Attributes 

PropertyTypeDescriptionSince Version
typeStringFormat of the resource.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
orderIdStringUnique record identifier for the parent order.30.0
IdStringUnique order product identifier.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: order.orderItems.effectiveDate=2013–01–01,2013–01–02.
  • Operators: >, >=, < and <=
  • The OR condition
ParametersDescription
orderThe object name of the record being filtered. In this resource, this is always order.
orderItemsThe relationship name of the field that the order’s data will be filtered by. In this resource, this is always orderItems.
field nameThe field whose value to filter by. For example, if you want to only retrieve order products with a certain start date, the field name is effectivedate.
valueThe value to filter by. For example, if you want to only retrieve order products that started on January 1, 2013, the value is 2013–01–01.

Response Body 

PropertyTypeDescription
totalSizeNumberTotal number of records listed.
recordsRecords[]Attributes and IDs of the new records.

Records 

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

Attributes 

PropertyTypeDescription
typeStringFormat of the resource.
urlURIResource URL.

Examples